|
wavelength 1.0.0
|
Generator of pseudo-random numbers with a lagged Fibonacci sequence of 256 words. More...
#include <rand.h>
Public Member Functions | |
| Rand (int nSeed) | |
| Construct a generator and seed it. | |
| void | Seed (int nSeed) |
| Fill the state table from a linear congruential sequence and reset both indices. | |
| int | Int (int nLow, int nHigh) |
| Draw an integer. | |
| float | Float (float fLow, float fHigh) |
| Draw a floating-point number. | |
| float | Float () |
| Draw a floating-point number in [0, 1). | |
| int | Int () |
| Draw the next word. | |
| Rand (int seed) | |
| Seed a new generator. | |
| void | Seed (int seed) |
| Refill the table. | |
Static Public Attributes | |
| static constexpr int | kTableSize = 256 |
| Words of the state table. | |
Generator of pseudo-random numbers with a lagged Fibonacci sequence of 256 words.
Random number generator with a table of 256 words.
The class is not polymorphic and has no RTTI. The name is inferred. The object is 0x408 bytes.
The RTTI records the class. The object is 0x408 bytes. Seed() fills the table from a linear congruential sequence and sets the two read positions 103 words apart, the R250 arrangement. The control seeds the generator and never draws from it.
|
explicit |
Construct a generator and seed it.
| nSeed | The seed. |
| Rand::Rand | ( | int | seed | ) |
Seed a new generator.
| seed | The seed. |
| void Rand::Seed | ( | int | nSeed | ) |
Fill the state table from a linear congruential sequence and reset both indices.
| nSeed | The starting value of the sequence. |
| int Rand::Int | ( | int | nLow, |
| int | nHigh ) |
Draw an integer.
| nLow | The smallest value. |
| nHigh | One more than the largest value. |
| float Rand::Float | ( | float | fLow, |
| float | fHigh ) |
Draw a floating-point number.
| fLow | The smallest value. |
| fHigh | The largest value. |
| float Rand::Float | ( | ) |
Draw a floating-point number in [0, 1).
| int Rand::Int | ( | ) |
Draw the next word.
Both indices wrap to zero on arriving at 249, so the draws cycle through the first 249 words.
| void Rand::Seed | ( | int | seed | ) |
Refill the table.
| seed | The seed. |
|
staticconstexpr |
Words of the state table.