rcolyer.net
RC Lib  Version 202403231100
Classes | Namespaces | Macros | Functions
RND.h File Reference

Provides random number generator classes. More...

#include "Macros.h"
#include "Types.h"
#include "RTime.h"
#include "Data1D.h"
#include "RStr.h"
#include "File.h"
#include <stdio.h>

Go to the source code of this file.

Classes

class  RC::BaseRND
 An abstract class which provides functions for obtaining randomness in convenient forms. More...
 
class  RC::RND
 A Mersenne Twister random number generator class with integer, array, or time-based seeding. More...
 
class  RC::EntropyRND
 Provides true random numbers sourced from environmental noise. More...
 
class  RC::URand
 Cryptographically strong RNG, uses /dev/urandom. More...
 

Namespaces

 RC
 

Macros

#define RC_MAKE_GET_RANGE(classname)
 Generates a family of RND_Get_Range functions. More...
 
#define RC_MAKE_RND_GEN(classname)
 Generates a family of random generator singletons. More...
 

Functions

u64 RC::RND_Get_Range (u64 range)
 Uses RND as a RandomNumberGenerator, e.g. for random_shuffle. More...
 
u64 RC::EntropyRND_Get_Range (u64 range)
 Uses EntropyRND as a RandomNumberGenerator, e.g. for random_shuffle. More...
 
u64 RC::URand_Get_Range (u64 range)
 Uses URand as a RandomNumberGenerator, e.g. for random_shuffle. More...
 
RND & RC::RND_Gen ()
 This returns a singleton of RND .
 
EntropyRND & RC::EntropyRND_Gen ()
 This returns a singleton of EntropyRND .
 
URand & RC::URand_Gen ()
 This returns a singleton of URand .
 

Detailed Description

Provides random number generator classes.

Macro Definition Documentation

◆ RC_MAKE_GET_RANGE

#define RC_MAKE_GET_RANGE (   classname)
Value:
/** \brief Uses classname as a RandomNumberGenerator, e.g. for random_shuffle
@param range The range of values that can be returned, starting with 0.
@return A random value from 0 up to and including range-1.
*/\
inline u64 classname##_Get_Range(u64 range) {\
static RC_MINGW_2014_BUGFIX classname rng;\
return rng.GetRange(range);\
}
uint64_t u64
64-bit unsigned integer.
Definition: Types.h:31

Generates a family of RND_Get_Range functions.

◆ RC_MAKE_RND_GEN

#define RC_MAKE_RND_GEN (   classname)
Value:
/** \brief This returns a singleton of classname. */\
inline classname& classname##_Gen() {\
static RC_MINGW_2014_BUGFIX classname rng;\
return rng;\
}

Generates a family of random generator singletons.

email address
— (c) 2015