RLib  5.7
RLib - an opensource, lightweight and multi-platform framework for cpp programming
System::Random Class Reference

Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet certain statistical requirements for randomness More...

Public Member Functions

 Random (ULONG seed)
 
ULONG NextLong ()
 Returns a random number in the range [0..MAXLONG-1] More...
 
template<typename T = intptr_t>
NextLong (T minValue, const T maxValue)
 Returns a random number within a specified range More...
 

Static Public Member Functions

static ULONG NextLong (_Inout_ PULONG Seed)
 Returns values that are uniformly distributed over the range from zero to the maximum possible LONG value less 1, if it is called repeatedly with the same Seed More...
 
static unsigned int GetDefaultSeed ()
 Gets a time-dependent default seed value More...
 
static void Srand ()
 Uses the system clock to provide a seed value. This is the most common way of instantiating the random number generator More...
 
static void Srand (unsigned int seed)
 Uses the specified seed value More...
 
static int NextInt ()
 Returns a nonnegative random number More...
 
template<typename T = intptr_t>
static T Next (T minValue, const T maxValue)
 Returns a random number within a specified range using a time-dependent default seed value More...
 

Protected Attributes

ULONG m_seed
 

Detailed Description

Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet certain statistical requirements for randomness

Member Function Documentation

unsigned int Random::GetDefaultSeed ( )
static

Gets a time-dependent default seed value

template<typename T = intptr_t>
static T System::Random::Next ( minValue,
const T  maxValue 
)
inlinestatic

Returns a random number within a specified range using a time-dependent default seed value

Parameters
minValueThe inclusive lower bound of the random number returned
maxValueThe exclusive upper bound of the random number returned
Returns
A signed integer greater than or equal to minValue and less than maxValue
int Random::NextInt ( )
static

Returns a nonnegative random number

Returns
A signed integer greater than or equal to zero and less than RAND_MAX(32767)
ULONG Random::NextLong ( )

Returns a random number in the range [0..MAXLONG-1]

ULONG Random::NextLong ( _Inout_ PULONG  Seed)
static

Returns values that are uniformly distributed over the range from zero to the maximum possible LONG value less 1, if it is called repeatedly with the same Seed

Returns
A signed integer greater than or equal to zero and less than MAXLONG
template<typename T = intptr_t>
T System::Random::NextLong ( minValue,
const T  maxValue 
)
inline

Returns a random number within a specified range

Parameters
minValueThe inclusive lower bound of the random number returned
maxValueThe exclusive upper bound of the random number returned
Returns
A signed integer greater than or equal to minValue and less than maxValue
void Random::Srand ( )
static

Uses the system clock to provide a seed value. This is the most common way of instantiating the random number generator

void Random::Srand ( unsigned int  seed)
static

Uses the specified seed value

Parameters
SeedA number used to calculate a starting value for the pseudo-random number sequence

The documentation for this class was generated from the following files: