3.7.11 rand.inc

A collection of macros for generating random numbers, as well as 4 predefined random number streams: RdmA, RdmB, RdmC, and RdmD. There are macros for creating random numbers in a flat distribution (all numbers equally likely) in various ranges, and a variety of other distributions.

3.7.11.1 Flat Distributions

SRand(Stream). "Signed rand()", returns random numbers in the range [-1, 1].
Parameters:

RRand(Min, Max, Stream). Returns random numbers in the range [Min, Max].
Parameters:

VRand(Stream). Returns random vectors in a box from < 0, 0, 0> to < 1, 1, 1>
Parameters:

VRand_In_Box(PtA, PtB, Stream). Like VRand(), this macro returns a random vector in a box, but this version lets you specify the two corners of the box.
Parameters:

VRand_In_Sphere(Stream). Returns a random vector in a unit-radius sphere located at the origin.
Parameters:

VRand_On_Sphere(Stream). Returns a random vector on the surface of a unit-radius sphere located at the origin.
Parameters:

VRand_In_Obj(Object, Stream) This macro takes a solid object and returns a random point that is inside it. It does this by randomly sampling the bounding box of the object, and can be quite slow if the object occupies a small percentage of the volume of its bounding box (because it will take more attempts to find a point inside the object). This macro is best used on finite, solid objects (non-solid objects, such as meshes and bezier patches, do not have a defined "inside", and will not work).
Parameters:

3.7.11.2 Other Distributions

3.7.11.2.1 Continuous Symmetric Distributions

Rand_Cauchy(Mu, Sigma, Stream). Cauchy distribution.
Parameters:

Rand_Student(N, Stream). Student's-t distribution.
Parameters:

Rand_Normal(Mu, Sigma, Stream). Normal distribution.
Parameters:

Rand_Gauss(Mu, Sigma, Stream). Gaussian distribution. Like Rand_Normal(), but a bit faster.
Parameters:

3.7.11.2.2 Continuous Skewed Distributions

Rand_Spline(Spline, Stream). This macro takes a spline describing the desired distribution. The T value of the spline is the output value, and the .y value its chance of occuring.
Parameters:

Rand_Gamma(Alpha, Beta, Stream). Gamma distribution.
Parameters:

Rand_Beta(Alpha, Beta, Stream). Beta variate.
Parameters:

Rand_Chi_Square(N, Stream). Chi Square random variate.
Parameters:

Rand_F_Dist(N, M, Stream). F-distribution.
Parameters:

Rand_Tri(Min, Max, Mode, Stream). Triangular distribution
Parameters:

Rand_Erlang(Mu, K, Stream). Erlang variate.
Parameters:

Rand_Exp(Lambda, Stream). Exponential distribution.
Parameters:

Rand_Lognormal(Mu, Sigma, Stream). Lognormal distribution.
Parameters:

Rand_Pareto(Alpha, Stream). Pareto distribution.
Parameters:

Rand_Weibull(Alpha, Beta, Stream). Weibull distribution.
Parameters:

3.7.11.2.3 Discrete Distributions

Rand_Bernoulli(P, Stream) and Prob(P, Stream). Bernoulli distribution. Output is true with probability equal to the value of P and false with a probability of 1 - P.
Parameters:

Rand_Binomial(N, P, Stream). Binomial distribution.
Parameters:

Rand_Geo(P, Stream). Geometric distribution.
Parameters:

Rand_Poisson(Mu, Stream). Poisson distribution.
Parameters: