Generates a random series of integers based on a uniform or flat distribution. The optional range arguments let you determine the output range.
GRANDINT(length, spacing, rangelow, rangehigh)
length |
- |
An integer. The length of the output series. |
spacing |
- |
A real, the spacing (delta x) between each
point of the |
rangelow |
- |
Optional. An integer, the low end of the range. Defaults to 1. |
rangehigh |
- |
Optional. An integer, the high end of the range. Defaults to 100. |
A series.
grandint(100, 0.1)
generates a uniformly distributed random integer series of 100 points, spaced every 0.1 x-units, with values ranging from 1 to 100.
W1: grandint(50000, 1, -100, 100);label("Integer Random Uniform")
W2: hist(w1, 201);label("Histogram")

W1 contains 50000 samples of uniformly distributed random integer values ranging from -100 to 100.
W2 contains a 200 sample normalized histogram of W1.
If no range is given, default is [1,100]. If only one range is given, range is [1,range] or [range,1], depending on whether range is positive or negative.
The probability density function, f(x), for uniformly distributed random values over the interval [a,b] is:
The cumulative distribution function, F(x), for uniformly distributed random values is:
The mean is:
and the variance is:
See SEEDRAND to set a new seed value for the pseudo-random sequence.
See RANDINT to generate an array of uniformly distributed random integers.
See GRANDOM to generate uniformly distributed random reals.