def pure ranvar.uniform(n: number): ranvar
def pure ranvar.uniform(m: number, n: number): ranvar
Returns a discrete uniform ranvar on the integer segment [0, n] or [m, n].
The arguments must be integers; for the two-argument overload, m must be
less than or equal to n.
n: the inclusive upper bound.
m: the inclusive lower bound.
Examples
table T = with
[| as N |]
[| 0 |]
[| 1 |]
[| 3 |]
[| 10 |]
T.R = ranvar.uniform(T.N)
show table "Uniform means" with
T.N
mean(T.R) as "Mean"
This outputs the following table:
N
Mean
0
0
1
0.5
3
1.5
10
5
table U = with
[| as M, as N |]
[| -1, 0 |]
[| 0, 1 |]
[| 1, 3 |]
[| 5, 10 |]
U.R = ranvar.uniform(U.M, U.N)
show table "Uniform means (two bounds)" with
U.M
U.N
mean(U.R) as "Mean"