Singleton class for generating random numbers.
More...
#include <math/Random.h>
|
void | seed (uint64 seed=0) |
| Seed the random number generator. More...
|
|
double | random () |
| Platform independent generation of random, double precision floating point random numbers in the interval [0.0, 1.0) More...
|
|
template<typename T > |
T | uniform (T min, T max) |
| Generate uniform distributed random numbers in the interval [min, max) More...
|
|
double | normal (double sigma=1.0) |
| Generate standard normally distributed random numbers using a source of uniformly distributed random numbers. More...
|
|
double | gaussian (double sigma=1.0) |
| deprecated, use normal() instead. More...
|
|
Singleton class for generating random numbers.
Use the MIRA_RANDOM macro to access the singleton.
Usage:
◆ Type
◆ seed()
void seed |
( |
uint64 |
seed = 0 | ) |
|
|
inline |
Seed the random number generator.
Is done automatically when creating the singleton
- Parameters
-
[in] | seed | The seed value: Default = 0 uses the current time for seeding the random generator. Therefore, the result will be a non-reproducible pseudo-random sequence. All other values allow to seed the random generator with a specific value and will result in a reproducible pseudo-random sequence. |
◆ random()
Platform independent generation of random, double precision floating point random numbers in the interval [0.0, 1.0)
◆ uniform()
T uniform |
( |
T |
min, |
|
|
T |
max |
|
) |
| |
|
inline |
Generate uniform distributed random numbers in the interval [min, max)
◆ normal()
double normal |
( |
double |
sigma = 1.0 | ) |
|
|
inline |
Generate standard normally distributed random numbers using a source of uniformly distributed random numbers.
Sigma must be >= 0.0!
◆ gaussian()
double gaussian |
( |
double |
sigma = 1.0 | ) |
|
|
inline |
◆ instance()
static Type& instance |
( |
| ) |
|
|
inlinestaticinherited |
Returns a reference to the singleton instance.
- Exceptions
-
XSingleton | If the singleton was already destroyed (dead reference) or not yet created (when using ExplicitInstantiation). |
◆ isDestroyed()
static bool isDestroyed |
( |
| ) |
|
|
inlinestaticinherited |
Returns true, if the singleton was already destroyed.
Trying to access it will result in an exception.
◆ makeInstance()
static Type* makeInstance |
( |
| ) |
|
|
inlinestaticprotectedinherited |
◆ destroyInstance()
static void destroyInstance |
( |
void |
| ) |
|
|
inlinestaticprotectedinherited |
◆ mira::singleton::CreateUsingNew< RandomGeneratorSingleton >
The documentation for this class was generated from the following file: