|
Blaze 3.9
|
Classes | |
| class | blaze::Random< RNG > |
| Random number generator. More... | |
| class | blaze::Rand< T, typename > |
| Default implementation of the Rand class. More... | |
Random number functions | |
| template<typename T> | |
| T | blaze::rand () |
| Random number function. | |
| template<typename T, typename... Args> | |
| T | blaze::rand (Args &&... args) |
| Random number function. | |
| template<typename T> | |
| void | blaze::randomize (T &&value) |
| Randomization of a given variable. | |
| template<typename T, typename... Args> | |
| void | blaze::randomize (T &&value, Args &&... args) |
| Randomization of a given variable. | |
| uint32_t | blaze::defaultSeed () |
| Returns the default random seed. | |
| template<typename RNG = DefaultRNG> | |
| uint32_t | blaze::getSeed () |
| Returns the current seed of the random number generator. | |
| template<typename RNG = DefaultRNG> | |
| void | blaze::setSeed (uint32_t seed) |
| Setting the seed of the random number generator. | |
The random number module provides the functionality to generate pseudo-random numbers within the Blaze library. In order to create series of random numbers, the following functions are are provided:
The templated rand() function is capable of generating random numbers for built-in integer and floating point data types as well as complex values. The rand() function can be given up to five parameters that depending on the type of the random number may have different meaning. The following example demonstrates the random number generation:
|
inline |
Returns the default random seed.
|
inline |
Returns the current seed of the random number generator.
|
inline |
Random number function.
The rand() function returns a default random number depending on the given data type. In case of integral data types, the function returns a random number in the range ![$ [0..max] $](../../form_191.png)

![$ [0..max] $](../../form_191.png)

|
inline |
|
inline |
Randomization of a given variable.
| value | The variable to be randomized. |
The randomize() function randomizes the given variable depending on its data type. In case of integral data types, the function returns a random number in the range ![$ [0..max] $](../../form_191.png)

![$ [0..max] $](../../form_191.png)

|
inline |
Randomization of a given variable.
| value | The value to be randomized. |
| args | The arguments for the random number generation. |
This randomize() function randomizes the given variable based on the given arguments args.
|
inline |
Setting the seed of the random number generator.
| seed | The new seed for the random number generator. |
This function can be used to set the seed for the random number generation in order to create a reproducible series of random numbers.