dstats.random

Generates random samples from a various probability distributions. These are mostly D ports of the NumPy random number generators.

Members

Functions

rBernoulli
int rBernoulli(double P = 0.5, ref RGen gen = rndGen)
rBeta
double rBeta(double a, double b, ref RGen gen = rndGen)
rBinomial
int rBinomial(int n, double p, ref RGen gen = rndGen)
rCauchy
double rCauchy(double X0, double gamma, ref RGen gen = rndGen)
rChiSquare
double rChiSquare(double df, ref RGen gen = rndGen)
rExponential
double rExponential(double lambda, ref RGen gen = rndGen)
rFisher
double rFisher(double df1, double df2, ref RGen gen = rndGen)
rGamma
double rGamma(double a, double b, ref RGen gen = rndGen)
rHypergeometric
int rHypergeometric(int n1, int n2, int n, ref RGen gen = rndGen)
rLaplace
double rLaplace(double mu = 0, double b = 1, ref RGen gen = rndGen)
rLogNormal
double rLogNormal(double mu, double sigma, ref RGen gen = rndGen)
rLogistic
double rLogistic(double loc, double scale, ref RGen gen = rndGen)
rNegBinom
int rNegBinom(double n, double p, ref RGen gen = rndGen)
rNormal
double rNormal(double mean, double sd, ref RGen gen = rndGen)
rPoisson
int rPoisson(double lam, ref RGen gen = rndGen)
rRayleigh
double rRayleigh(double mode, ref RGen gen = rndGen)
rStudentsT
double rStudentsT(double df, ref RGen gen = rndGen)
rWald
double rWald(double mu, double lambda, ref RGen gen = rndGen)
rWeibull
double rWeibull(double shape, double scale = 1, ref RGen gen = rndGen)
randArray
auto randArray(size_t N, auto ref Args args)

Convenience function to allow one-statement creation of arrays of random numbers.

randArray
R[] randArray(size_t N, auto ref Args args)

Allows the creation of an array of random numbers with an explicitly specified type. Useful, for example, when single-precision floats are all you need.

randRange
RandRange!(randFun, T) randRange(T params)

Turn a random number generator function into an infinite range. Params is a tuple of the distribution parameters. This is specified in the same order as when calling the function directly.

Structs

RandRange
struct RandRange(alias randFun, T...)

Meta