![]() |
Classes | |
class | blaze::Random< Type > |
Random number generator.The Random class encapsulates the initialization of the given random number generator with a pseudo-random seed obtained by the std::time() function. Currently, the mersenne-twister mt19937 as provided by the boost library is used per default. For more information see the class description of the boost library: More... | |
class | blaze::Rand< T > |
Default implementation of the Rand class for integral data types.This default implementation of the Rand class creates random, integral numbers in the range ![]() | |
Random number functions | |
template<typename T > | |
T | blaze::rand () |
Random number function. More... | |
template<typename T , typename A1 > | |
T | blaze::rand (const A1 &a1) |
Random number function. More... | |
template<typename T , typename A1 , typename A2 > | |
T | blaze::rand (const A1 &a1, const A2 &a2) |
Random number function. More... | |
template<typename T , typename A1 , typename A2 , typename A3 > | |
T | blaze::rand (const A1 &a1, const A2 &a2, const A3 &a3) |
Random number function. More... | |
template<typename T , typename A1 , typename A2 , typename A3 , typename A4 > | |
T | blaze::rand (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) |
Random number function. More... | |
template<typename T , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 > | |
T | blaze::rand (const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) |
Random number function. More... | |
template<typename T > | |
void | blaze::randomize (T &value) |
Randomization of a given variable. More... | |
template<typename T , typename A1 > | |
void | blaze::randomize (T &value, const A1 &a1) |
Randomization of a given variable. More... | |
template<typename T , typename A1 , typename A2 > | |
void | blaze::randomize (T &value, const A1 &a1, const A2 &a2) |
Randomization of a given variable. More... | |
template<typename T , typename A1 , typename A2 , typename A3 > | |
void | blaze::randomize (T &value, const A1 &a1, const A2 &a2, const A3 &a3) |
Randomization of a given variable. More... | |
template<typename T , typename A1 , typename A2 , typename A3 , typename A4 > | |
void | blaze::randomize (T &value, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) |
Randomization of a given variable. More... | |
template<typename T , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 > | |
void | blaze::randomize (T &value, const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) |
Randomization of a given variable. More... | |
uint32_t | blaze::getSeed () |
Returns the current seed of the random number generator. More... | |
void | blaze::setSeed (uint32_t seed) |
Setting the seed of the random number generator. More... | |
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:
Note: In order to reproduce certain series of random numbers, the seed of the random number generator has to be set explicitly via the setSeed() function. Otherwise a random seed is used for the random number generation.
|
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 , where max is the maximal value of the data type T. In case of floating point data types, the function returns a random number in the range
. In case of complex data types, the function returns a random complex value where both the real and the imaginary part have been set according to the element type of the complex value (
for integral elements,
for floating point elements).
|
inline |
|
inline |
|
inline |
Random number function.
a1 | First argument for the random number generation. |
a2 | Second argument for the random number generation. |
a3 | Third argument for the random number generation. |
This rand() function creates a random number based on the given arguments a1, a2, and a3.
|
inline |
Random number function.
a1 | First argument for the random number generation. |
a2 | Second argument for the random number generation. |
a3 | Third argument for the random number generation. |
a4 | Fourth argument for the random number generation. |
This rand() function creates a random number based on the given arguments a1, a2, a3, and a4.
|
inline |
Random number function.
a1 | First argument for the random number generation. |
a2 | Second argument for the random number generation. |
a3 | Third argument for the random number generation. |
a4 | Fourth argument for the random number generation. |
a5 | Fifth argument for the random number generation. |
This rand() function creates a random number based on the given arguments a1, a2, a3, a4, and a5.
|
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 , where max is the maximal value of the data type T. In case of floating point data types, the function returns a random number in the range
. In case of complex data types, the function returns a random complex value where both the real and the imaginary part have been set according to the element type of the complex value (
for integral elements,
for floating point elements).
|
inline |
Randomization of a given variable.
value | The value to be randomized. |
a1 | First argument for the random number generation. |
This randomize() function randomizes the given variable based on the given argument a1.
|
inline |
Randomization of a given variable.
value | The value to be randomized. |
a1 | First argument for the random number generation. |
a2 | Second argument for the random number generation. |
This randomize() function randomizes the given variable based on the given argument a1 and a2
|
inline |
Randomization of a given variable.
value | The value to be randomized. |
a1 | First argument for the random number generation. |
a2 | Second argument for the random number generation. |
a3 | Third argument for the random number generation. |
This randomize() function randomizes the given variable based on the given argument a1, a2, and a3.
|
inline |
Randomization of a given variable.
value | The value to be randomized. |
a1 | First argument for the random number generation. |
a2 | Second argument for the random number generation. |
a3 | Third argument for the random number generation. |
a4 | Fourth argument for the random number generation. |
This randomize() function randomizes the given variable based on the given argument a1, a2, a3, and a4.
|
inline |
Randomization of a given variable.
value | The value to be randomized. |
a1 | First argument for the random number generation. |
a2 | Second argument for the random number generation. |
a3 | Third argument for the random number generation. |
a4 | Fourth argument for the random number generation. |
a5 | Fifth argument for the random number generation. |
This randomize() function randomizes the given variable based on the given argument a1, a2, a3, a4, and a5.
|
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.