Ziggurat

ziggurat method for decreasing distributions. Marsaglia, Tsang, Journal of Statistical Software, 2000 If has negative is true the distribution is assumed to be symmetric with respect to 0, otherwise it is assumed to be from 0 to infinity. Struct based to avoid extra indirection when wrapped in a class (and it should be wrapped in a class and not used directly). Call style initialization avoided on purpose (this is a big structure, you don't want to return it)

Members

Aliases

SourceT
alias SourceT = Ziggurat
Undocumented in source.

Functions

getFastRandom
T getFastRandom()

returns a single value with the probability distribution of the current Ziggurat and slightly worse randomness (in the normal case uses only 32 random bits). Cannot be 0.

getRandom
T getRandom()

returns a single value with the probability distribution of the current Ziggurat

randomize
U randomize(U a)

initializes the argument with the probability distribution given and returns it for arrays this might potentially be faster than a naive loop

randomizeOp
U randomizeOp(S delegate(T) op, U a)

initializes the variable with the result of mapping op on the random numbers (of type T)

Static functions

create
Ziggurat create(RandG rGenerator, real xLast, bool check_error)

initializes the ziggurat

Templates

randomizeOp2
template randomizeOp2(alias op)

initializes the variable with the result of mapping op on the random numbers (of type T)

Variables

fVal
T[nBlocks + 1] fVal;
Undocumented in source.
nBlocks
enum int nBlocks;
Undocumented in source.
posBlock
T[nBlocks + 1] posBlock;
Undocumented in source.
r
RandG r;
Undocumented in source.

Meta