nuklei::Random Class Reference

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.
 

Detailed Description

Implements random variate generators for various distributions.

Definition at line 19 of file Random.h.

Member Function Documentation

◆ gaussian()

double nuklei::Random::gaussian ( double  sigma)
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().

◆ seed()

void nuklei::Random::seed ( unsigned  s)
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().

◆ triangle()

double nuklei::Random::triangle ( double  b)
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.

◆ uniform() [1/2]

double nuklei::Random::uniform ( )
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().

◆ uniform() [2/2]

double nuklei::Random::uniform ( double  a,
double  b 
)
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.

◆ uniformDirection2d()

Vector2 nuklei::Random::uniformDirection2d ( )
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.

◆ uniformDirection3d()

Vector3 nuklei::Random::uniformDirection3d ( )
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.

◆ uniformInt()

unsigned long int nuklei::Random::uniformInt ( unsigned long int  n)
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.


The documentation for this class was generated from the following files:
© Copyright 2007-2013 Renaud Detry.
Distributed under the terms of the GNU General Public License (GPL).
(See accompanying file LICENSE.txt or copy at http://www.gnu.org/copyleft/gpl.html.)
Revised Sun Sep 13 2020 19:10:12.