uniform

fnauto uniform(string boundaries = "[)", T1, T2)(T1 a, T2 b) if (!is(CommonType!(T1, T2) == void))

Generates a number between a and b. The boundaries parameter controls the shape of the interval (open vs. closed on either side). Valid values for boundaries are `"[]"`, "(]", "[)", and `"()"`. The default interval is closed to the left and open to the right. The version that does not take urng uses the default generator rndGen.

Parameters

alower bound of the _uniform distribution
bupper bound of the _uniform distribution
urng(optional) random number generator to use; if not specified, defaults to rndGen

Returns

A single random variate drawn from the _uniform distribution

between a and b, whose type is the common type of these parameters

fnauto uniform(string boundaries = "[)", T1, T2, UniformRandomNumberGenerator)(T1 a, T2 b, ref UniformRandomNumberGenerator urng) if (isFloatingPoint!(CommonType!(T1, T2)) && isUniformRNG!UniformRandomNumberGenerator)

ditto

fnauto uniform(string boundaries = "[)", T1, T2, RandomGen)(T1 a, T2 b, ref RandomGen rng) if ((isIntegral!(CommonType!(T1, T2)) || isSomeChar!(CommonType!(T1, T2))) && isUniformRNG!RandomGen)

ditto

fnauto uniform(T, UniformRandomNumberGenerator)(ref UniformRandomNumberGenerator urng) if (!is(T == enum) && (isIntegral!T || isSomeChar!T) && isUniformRNG!UniformRandomNumberGenerator)

Generates a uniformly-distributed number in the range [T.min, T.max] for any integral or character type T. If no random number generator is passed, uses the default rndGen.

If an enum is used as type, the random variate is drawn with equal probability from any of the possible values of the enum E.

Parameters

urng(optional) random number generator to use; if not specified, defaults to rndGen

Returns

Random variate drawn from the _uniform distribution across all

possible values of the integral, character or enum type T.

fnauto uniform(T)() if (!is(T == enum) && (isIntegral!T || isSomeChar!T))

Ditto

fnauto uniform(E, UniformRandomNumberGenerator)(ref UniformRandomNumberGenerator urng) if (is(E == enum) && isUniformRNG!UniformRandomNumberGenerator)

ditto

fnauto uniform(E)() if (is(E == enum))

Ditto