Implements random variate generators for various distributions. More...
#include <Random.h>
Static Public Member Functions | |
static void | seed (unsigned s) |
Seeds the random generators with s . More... | |
static double | uniform () |
This function returns a double precision floating point number uniformly distributed in the range \( [0,1) \). More... | |
static double | uniform (double a, double b) |
This function returns a double precision floating point number uniformly distributed in the range \( [a,b) \). More... | |
static unsigned long int | uniformInt (unsigned long int n) |
This function returns a random integer from 0 to n-1 inclusive. More... | |
static double | triangle (double b) |
This function returns a random variate from the triangle distribution of zero mean and base b . More... | |
static double | gaussian (double sigma) |
This function returns a Gaussian random variate, with mean zero and standard deviation sigma . More... | |
static double | beta (double a, double b) |
This function returns a random variate from the beta distribution. | |
static Vector2 | uniformDirection2d () |
This function returns a random direction vector \( v = (x,y) \) in two dimensions. More... | |
static Vector3 | uniformDirection3d () |
This function returns a random direction vector \( v = (x,y,z) \) in three dimensions. More... | |
static Quaternion | uniformQuaternion () |
This function returns rotation uniformly distributed on \( SO(3) \). | |
static void | printRandomState () |
static bool | init () |
Used internally. | |
Implements random variate generators for various distributions.
|
static |
This function returns a Gaussian random variate, with mean zero and standard deviation sigma
.
Use the transformation \( z = \mu + x \) on the numbers returned by this method to obtain a Gaussian distribution with mean \( \mu \).
Definition at line 253 of file Random.cpp.
Referenced by uniformQuaternion().
|
static |
Seeds the random generators with s
.
This method will seed a built-in GSL generator, and the standard library's generator.
Definition at line 135 of file Random.cpp.
Referenced by init().
|
static |
This function returns a random variate from the triangle distribution of zero mean and base b
.
Use the transformation \( z = \mu + x \) on the numbers returned by this method to obtain a triangle distribution with mean \( \mu \).
Definition at line 229 of file Random.cpp.
|
static |
This function returns a double precision floating point number uniformly distributed in the range \( [0,1) \).
The range includes 0.0 but excludes 1.0.
Definition at line 159 of file Random.cpp.
Referenced by uniformQuaternion().
|
static |
This function returns a double precision floating point number uniformly distributed in the range \( [a,b) \).
The range includes a but excludes b.
Definition at line 186 of file Random.cpp.
|
static |
This function returns a random direction vector \( v = (x,y) \) in two dimensions.
The vector is normalized such that \( |v|^2 = x^2 + y^2 = 1 \).
Definition at line 292 of file Random.cpp.
|
static |
This function returns a random direction vector \( v = (x,y,z) \) in three dimensions.
The vector is normalized such that \( |v|^2 = x^2 + y^2 + z^2 = 1 \).
Definition at line 320 of file Random.cpp.
|
static |
This function returns a random integer from 0 to n-1 inclusive.
All integers in the range \( [0,n-1] \) are produced with equal probability.
Definition at line 195 of file Random.cpp.