The marsaglia random number generator. More...

#include "murl_util_rng.h"

Inheritance diagram for Murl::Util::Marsaglia:

Public Member Functions

 Marsaglia ()
 The default constructor. More...
 
 Marsaglia (UInt32 seed)
 Constructor taking a seed value. More...
 
void Seed (UInt32 seed) override
 Seed the random number generator. More...
 
UInt32 Rand () override
 Get a random number in the full UInt32 range. More...
 
- Public Member Functions inherited from Murl::Util::Rng
virtual ~Rng ()=default
 The destructor.
 
Bool RandBool ()
 Get a random Bool value. More...
 
UInt32 RandUInt (UInt32 from, UInt32 to)
 Get a random UInt32 value within a specified range. More...
 
SInt32 RandSInt (SInt32 from, SInt32 to)
 Get a random SInt32 value within a specified range. More...
 
Real RandReal (Real from, Real to)
 Get a random Real value within a specified range. More...
 
Double RandDouble (Double from, Double to)
 Get a random Double value within a specified range. More...
 
SInt32 Draw (const UInt32Array &distribution)
 Draw an index from a distribution array. More...
 
SInt32 DrawNoReplacement (UInt32Array &distribution)
 Draw an index from a distribution array with no replacement. More...
 
SInt32 DrawNoReplacement (UInt32Array &distribution, UInt32 decrement)
 Draw an index from a distribution array with no replacement. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Murl::Util::Rng
 Rng ()=default
 The default constructor.
 

Detailed Description

The marsaglia random number generator.

The marsaglia generator has low quality with a period of 2^32 only, but calculates fast results and uses 32 bit state memory only. The better choice with an acceptable overhead is the TT800 or Well1024 class.

Constructor & Destructor Documentation

◆ Marsaglia() [1/2]

Murl::Util::Marsaglia::Marsaglia ( )

The default constructor.

Seed() the random number generator with the current time nanoseconds fraction.

◆ Marsaglia() [2/2]

Murl::Util::Marsaglia::Marsaglia ( UInt32  seed)

Constructor taking a seed value.

Parameters
seedThe seed value.

Member Function Documentation

◆ Seed()

void Murl::Util::Marsaglia::Seed ( UInt32  seed)
overridevirtual

Seed the random number generator.

Parameters
seedThe seed value.

Implements Murl::Util::Rng.

◆ Rand()

UInt32 Murl::Util::Marsaglia::Rand ( )
overridevirtual

Get a random number in the full UInt32 range.

Returns
The random number.

Implements Murl::Util::Rng.


The documentation for this class was generated from the following file:
  • murl_util_rng.h


Copyright © 2011-2024 Spraylight GmbH.