|
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 , where max is the maximal value of the given data type T. More...
|
|
|
template<typename T > |
T | blaze::rand () |
| Random number function.
|
|
template<typename T , typename A1 > |
T | blaze::rand (const A1 &a1) |
| Random number function.
|
|
template<typename T , typename A1 , typename A2 > |
T | blaze::rand (const A1 &a1, const A2 &a2) |
| Random number function.
|
|
template<typename T , typename A1 , typename A2 , typename A3 > |
T | blaze::rand (const A1 &a1, const A2 &a2, const A3 &a3) |
| Random number function.
|
|
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.
|
|
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.
|
|
uint32_t | blaze::getSeed () |
| Returns the current seed of the random number generator.
|
|
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:
using namespace blaze;
int i = rand<int>();
double d = rand<double>( 2.0, 4.0 );
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.
uint32_t blaze::getSeed |
( |
| ) |
|
|
inline |
Returns the current seed of the random number generator.
- Returns
- The current seed of the random number generator.
template<typename T , typename A1 >
T blaze::rand |
( |
const A1 & |
a1 | ) |
|
|
inline |
Random number function.
- Parameters
-
a1 | First argument for the random number generation. |
- Returns
- The generated random number.
This rand() function creates a random number based on the given argument a1.
template<typename T , typename A1 , typename A2 >
T blaze::rand |
( |
const A1 & |
a1, |
|
|
const A2 & |
a2 |
|
) |
| |
|
inline |
Random number function.
- Parameters
-
a1 | First argument for the random number generation. |
a2 | Second argument for the random number generation. |
- Returns
- The generated random number.
This rand() function creates a random number based on the given arguments a1 and a2.
template<typename T , typename A1 , typename A2 , typename A3 >
T blaze::rand |
( |
const A1 & |
a1, |
|
|
const A2 & |
a2, |
|
|
const A3 & |
a3 |
|
) |
| |
|
inline |
Random number function.
- Parameters
-
a1 | First argument for the random number generation. |
a2 | Second argument for the random number generation. |
a3 | Third argument for the random number generation. |
- Returns
- The generated random number.
This rand() function creates a random number based on the given arguments a1, a2, and a3.
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 |
|
) |
| |
|
inline |
Random number function.
- Parameters
-
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. |
- Returns
- The generated random number.
This rand() function creates a random number based on the given arguments a1, a2, a3, and a4.
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 |
|
) |
| |
|
inline |
Random number function.
- Parameters
-
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. |
- Returns
- The generated random number.
This rand() function creates a random number based on the given arguments a1, a2, a3, a4, and a5.
void blaze::setSeed |
( |
uint32_t |
seed | ) |
|
|
inline |
Setting the seed of the random number generator.
- Parameters
-
seed | The new seed for the random number generator. |
- Returns
- void
This function can be used to set the seed for the random number generation in order to create a reproducible series of random numbers.