This class is an implementation of D. H. Lehmer's linear congruential formula as described by Donald E. Knuth in: The Art of Computer Programming, Volume 2, Section 3.2.1.
|
Public Types
|
|
typedef spec::Handle |
Handle |
| |
Random Handle definition.
|
|
typedef spec::View |
View |
| |
Random View definition.
|
|
typedef spec::Holder |
Holder |
| |
Random Holder definition.
|
Public Member Functions
|
| virtual int32_t |
nextInt32 (int32_t n) |
| |
Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.
|
| virtual bool |
nextBoolean () |
| |
Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.
|
| virtual int32_t |
nextInt32 () |
| |
Returns the next pseudorandom, uniformly distributed int32_t value from this random number generator's sequence.
|
| virtual int64_t |
nextInt64 () |
| |
Returns the next pseudorandom, uniformly distributed int64_t value from this random number generator's sequence.
|
| virtual float32_t |
nextFloat32 () |
| |
Returns the next pseudorandom, uniformly distributed float32_t value from this random number generator's sequence.
|
| virtual float64_t |
nextFloat64 () |
| |
Returns the next pseudorandom, uniformly distributed float64_t value from this random number generator's sequence.
|
|
virtual void |
seed () |
| |
Provides a default seeding algorithm that is used to seed this random number if no seed is provided.
|
|
virtual void |
setSeed (int64_t lSeed) |
| |
Sets the seed of this random number generator using a single long seed.
|
Static Public Member Functions
|
static
ObjectArray::Handle |
randomize (ObjectArray::Handle ha) |
| |
Randomize the order of the elements within the passed array.
|
| static List::Handle |
randomize (List::Handle hl) |
| |
Randomize the order of the elements within the passed list.
|
| static Handle |
getInstance () |
| |
Return the static Random instance.
|
Protected Member Functions
|
| |
Random () |
| |
Create a new Random instance without supplying a seed.
|
|
|
Random (int64_t lSeed) |
| |
Create a new Random instance, specifying a seed to use.
|
| virtual int32_t |
next (int32_t nBits) |
| |
Implementation of the random number algorithm which generates the next pseudorandom number.
|
Protected Attributes
|
|
NativeAtomic64 |
m_atomicSeed |
| |
The internal state associated with this pseudorandom number generator.
|