Allolib
1.0
C++ Components For Interactive Multimedia
|
Random number generation utilities. More...
Classes | |
class | Random |
class | LinCon |
Linear congruential uniform pseudo-random number generator. More... | |
class | MulLinCon |
Multiplicative linear congruential uniform pseudo-random number generator. More... | |
class | Tausworthe |
Combined Tausworthe uniform pseudo-random number generator. More... | |
Functions | |
rand_uniformf & | global () |
Get global random number generator. | |
rand_normal & | global_normal () |
rand_uniformi & | global_ui () |
int | uniformi (int high) |
int | uniformi (int low, int high) |
float | uniform () |
Returns uniform random in [0, 1) | |
template<class T > | |
T | uniform (const T &hi) |
Returns uniform random in [0, hi) | |
template<class T > | |
T | uniform (const T &hi, const T &lo) |
Returns uniform random in [lo, hi) | |
float | uniformS () |
Returns signed uniform random in (-1, 1) | |
template<class T > | |
float | uniformS (const T &lim) |
Returns signed uniform random in (-lim, lim) | |
template<int N, class T > | |
void | ball (T *point) |
Returns point within a unit ball. More... | |
template<template< int, class > class VecType, int N, class T > | |
void | ball (VecType< N, T > &point) |
Returns point within a unit ball. | |
template<class VecType > | |
VecType | ball () |
Returns point within a unit ball. | |
float | normal () |
Returns standard normal variate. | |
float | gaussian () |
float | triangle () |
Returns triangle distribution variate, in (-1,1) | |
bool | prob () |
Returns true with probability 0.5. | |
bool | prob (float p) |
Returns true with probability p. | |
float | sign (float x=1.f) |
Returns argument with sign randomly flipped. | |
Random number generation utilities.
|
inline |
Returns point within a unit ball.
To get a random point on a sphere, simply normalize the result.
N | dimensions of ball |
[in] | point | an array of size N |
Definition at line 148 of file al_StdRandom.hpp.