Creates and seeds a new generator
returns an exp distribued number
returns an exp distribued number with the given scale beta
exponential distribued numbers with a different default beta f=1/beta*exp(-x/beta)
generators of exp distribued numbers (beta=1) of the given type f=1/beta*exp(-x/beta)
reads the current status from a string (that should have been trimmed) returns the number of chars read
returns a gamma distribued number from Marsaglia and Tsang, ACM Transaction on Mathematical Software, Vol. 26, N. 3 2000, p 363-372
gamma distribued numbers with the given default alpha
returns a random number
compatibility with old Random, deprecate??
returns a normal distribued number
generators of normal numbers with a different default sigma/mu f=exp(-x*x/(2*sigma^2))/(sqrt(2 pi)*sigma)
returns a normal distribued number with the given sigma
returns a normal distribued number with the given sigma and mu
generators of normal numbers (sigma=1,mu=0) of the given type f=exp(-x*x/(2*sigma^2))/(sqrt(2 pi)*sigma)
chainable call style initialization of variables (thorugh a call to randomize)
initialize el
randomizes the given array and returns it (for some types this is potentially more efficient, both from the use of random numbers and speedwise)
randomizes the given array and returns it (for some types this is potentially more efficient, both from the use of random numbers and speedwise)
randomizes the given variable and returns it (for some types this is potentially more efficient, both from the use of random numbers and speedwise)
randomizes the given variable like uniformRSymm and returns it (for some types this is potentially more efficient, both from the use of random numbers and speedwise)
if source.canSeed seeds the generator using the shared rand generator (use urandom directly if available?)
if source.canSeed seeds the generator using the given source of uints
returns another (mostly indipendent, depending on seed size) random generator
writes the current status in a string
uniform distribution on the whole integer range, and on [0;1] for floats
uniform distribution on the whole integer range, and on (0;1) for floats should return simply this??
returns a random element of the given array (which must be non empty)
uniform distribution on the range [0;to) for integer types, and on the (0;to) range for floating point types. Same caveat as uniform(T) apply
uniform distribution [from;to) for integers, and (from;to) for floating point numbers. if boundCheck is false the bounds are included in the floating point number distribution. the range for int and long is limited to only half the possible range (it could be worked around using long aritmethic for int, and doing a carry by hand for long, but I think it is seldomly needed, for int you are better off using long when needed)
uniform distribution [from;to) for ints and [from;to] for reals
uniform distribution [from;to) for ints and (from;to) for reals
uniform distribution [0;to) for ints, [0:to] for reals
uniform distribution [0;to) for ints, (0:to) for reals
uniform distribution on the range (-to;to) for integer types, and on the (-to;0)(0;to) range for floating point types if boundCheck is true. If boundCheck=false the range changes to [-to;0)u(0;to] with a slightly lower propability at the bounds for floating point numbers. excludeZero controls if 0 is excluded or not (by default float exclude it, ints no). Please note that the probability of 0 in floats is very small due Cannot be used on unsigned types.
uniform distribution (-to;to) for ints and [-to;0)u(0;to] for reals
uniform distribution (-to;to) for ints and (-to;0)u(0;to) for reals
uniform distribution on the whole range of integer types, and on the (0;1) range for floating point types. Floating point guarantees the initialization of the full mantissa, but due to rounding effects it might have *very* small dependence due to rounding effects on the least significant bit (in case of tie 0 is favored). if boundCheck is false in the floating point case bounds might be included (but with a lower propability than other numbers)
compatibility with old Random, deprecate??
gamma distribution f=x^(alpha-1)*exp(-x/theta)/(gamma(alpha)*theta^alpha) alpha has to be bigger than 1, for alpha<1 use gammaD(alpha)=gammaD(alpha+1)*pow(r.uniform!(T),1/alpha) from Marsaglia and Tsang, ACM Transaction on Mathematical Software, Vol. 26, N. 3 2000, p 363-372
uniform distribution on the whole range for integers, and on (0;1) for floats with boundCheck=true this is equivalent to r itself, here just for completness
uniform distribution on the subrange (-to;to) for integers, (0;to) for floats
uniform distribution on the subrange [0;to) for integers, (0;to) for floats
uniform distribution on the subrange (-to;to) for integers, (-to;0)u(0;to) for floats excludeZero controls if the zero should be excluded, boundCheck if the boundary should be excluded for floats
Class that represents a random number generator. Normally you should get random numbers either with call-like interface: auto r=new Random(); r(i)(j)(k); or with randomize r.randomize(i); r.randomize(j); r.randomize(k); if you use this you should be able to easily switch distribution later, as all distributions support this interface, and can be built on the top of RandomG auto r2=r.NormalSource!(float)(); r2(i)(j)(k); there are utility methods within random for the cases in which you do not want to build a special distribution for just a few numbers