|
Vital
|
A basic random number generator for producing uniform distributions of floats. More...
#include <utils.h>
Public Member Functions | |
| RandomGenerator (mono_float min, mono_float max) | |
| Constructs a RandomGenerator with specified min and max values. | |
| RandomGenerator (const RandomGenerator &other) | |
| Copy constructor, but it re-seeds the engine for uniqueness. | |
| force_inline mono_float | next () |
| Returns the next random float in [min, max]. | |
| force_inline poly_float | polyNext () |
| Produces a poly_float with random values in each lane. | |
| force_inline poly_float | polyVoiceNext () |
| Produces a poly_float with random values assigned in pairs (every 2 lanes share the same random value). | |
| force_inline poly_float | polyNext (poly_mask mask) |
Produces a poly_float of random values, only generated for lanes set in mask. | |
| force_inline void | seed (int new_seed) |
Reseeds the internal random engine with new_seed. | |
Static Public Attributes | |
| static int | next_seed_ = 0 |
| Static seed counter used to automatically assign seeds if none specified. | |
A basic random number generator for producing uniform distributions of floats.
It uses an internal Mersenne Twister (std::mt19937) and a uniform distribution between given min and max values.
|
inline |
Constructs a RandomGenerator with specified min and max values.
| min | The minimum floating-point value (inclusive). |
| max | The maximum floating-point value (inclusive). |
|
inline |
Copy constructor, but it re-seeds the engine for uniqueness.
| other | Another RandomGenerator to copy min/max from. |
|
inline |
Returns the next random float in [min, max].
|
inline |
Produces a poly_float with random values in each lane.
|
inline |
Produces a poly_float of random values, only generated for lanes set in mask.
| mask | A poly_mask indicating which lanes need new random values. |
|
inline |
Produces a poly_float with random values assigned in pairs (every 2 lanes share the same random value).
|
inline |
Reseeds the internal random engine with new_seed.
| new_seed | The new seed to use. |
|
static |
Static seed counter used to automatically assign seeds if none specified.
Initializes the static seed counter for RandomGenerator.