Lib
QOLを高める
Functions
yappy::framework::random Namespace Reference

Random number framework. More...

Functions

unsigned int generateRandomSeed ()
 Generate nondeterministic random number for seed. More...
 
void setSeed (unsigned int seed)
 Set random seed. More...
 
unsigned int nextRawUInt32 ()
 Get next uint32 random number. More...
 
int nextInt (int a=0, int b=std::numeric_limits< int >::max())
 Get next int random number. More...
 
double nextDouble (double a=0.0, double max=1.0)
 Get next double random number. More...
 

Detailed Description

Random number framework.

Function Documentation

unsigned int yappy::framework::random::generateRandomSeed ( )

Generate nondeterministic random number for seed.

Uses std::random_device. Probably uses win32 CryptGenRandom(). This function will be slow.

Returns
random number

Definition at line 19 of file framework.cpp.

double yappy::framework::random::nextDouble ( double  a = 0.0,
double  max = 1.0 
)

Get next double random number.

Parameters
[in]amin value (inclusive)
[in]bmax value (exclusive)
Returns
[a, b)

Definition at line 40 of file framework.cpp.

int yappy::framework::random::nextInt ( int  a = 0,
int  b = std::numeric_limits< int >::max() 
)

Get next int random number.

Parameters
[in]amin value (inclusive)
[in]bmax value (inclusive)
Returns
[a, b]

Definition at line 34 of file framework.cpp.

unsigned int yappy::framework::random::nextRawUInt32 ( )

Get next uint32 random number.

Returns
[0x00000000, 0xffffffff]

Definition at line 29 of file framework.cpp.

void yappy::framework::random::setSeed ( unsigned int  seed)

Set random seed.

Parameters
[in]seedRandom seed.
See also
generateRandomSeed()

Definition at line 24 of file framework.cpp.