This is a random number generator which uses linear congruences. It uses the modulus 263. More...
#include <random_number_generator.h>
Public Member Functions | |
IntenseM2P63LinearCongruenceRandomNumberGenerator (unsigned long long multiplier, unsigned long long adder, unsigned long long seed, int accept_bits) | |
The constructor. More... | |
std::string | GetName () |
Returns a string representation of this object. More... | |
void | LoadData (std::ifstream *) |
Loads data to reset the state of the random number generator to the state which was stored. More... | |
long long | RandomLongLong () |
Creates a random long long value. More... | |
mpf_t * | RandomMpft () |
Creates a random mpf_t value in the interval [0,1]. More... | |
void | StoreData (std::ofstream *) |
Stores the current state of this random number generator, such that it can completely restore the current state with this data. More... | |
Public Member Functions inherited from arbitraryprecisioncalculation::RandomNumberGenerator | |
virtual | ~RandomNumberGenerator () |
The destructor. More... | |
Detailed Description
This is a random number generator which uses linear congruences. It uses the modulus 263.
Constructor & Destructor Documentation
arbitraryprecisioncalculation::IntenseM2P63LinearCongruenceRandomNumberGenerator::IntenseM2P63LinearCongruenceRandomNumberGenerator | ( | unsigned long long | multiplier, |
unsigned long long | adder, | ||
unsigned long long | seed, | ||
int | accept_bits | ||
) |
The constructor.
- Parameters
-
multiplier The factor in the linear congruence. adder The additive value in the linear congruence. seed The initial seed of the random number generator. accept_bits The number of bits used by mpf_t generation from a call of function random long long.
Member Function Documentation
|
virtual |
Returns a string representation of this object.
- Returns
- The name of the object.
Implements arbitraryprecisioncalculation::RandomNumberGenerator.
|
virtual |
Loads data to reset the state of the random number generator to the state which was stored.
- Parameters
-
input_stream The stream which contains the data about the state of the random number generator.
Implements arbitraryprecisioncalculation::RandomNumberGenerator.
|
virtual |
Creates a random long long value.
Calculates the next random by the equation (adder + multiplier · S) mod 263, where S is the previous random value or the initial seed (if it is the first call of this function) and mod means the modulo operation.
- Returns
- The random value.
Implements arbitraryprecisioncalculation::RandomNumberGenerator.
|
virtual |
Creates a random mpf_t value in the interval [0,1].
Repeatedly calls random long long function until all bits of result value are randomly initialized. Each time only the specified number of bits are used.
- Returns
- The random value.
Implements arbitraryprecisioncalculation::RandomNumberGenerator.
|
virtual |
Stores the current state of this random number generator, such that it can completely restore the current state with this data.
- Parameters
-
output_stream The output stream where the state should be stored.
Implements arbitraryprecisioncalculation::RandomNumberGenerator.
The documentation for this class was generated from the following file:
- src/arbitrary_precision_calculation/random_number_generator.h