MapleTA[Builtin]
range
random integers from a range defined with a step size
Calling Sequence
Parameters
Description
Examples
Compatibility
range(n)
range(m, n)
range(m, n, k)
m, n, k
-
integer
The range command returns random integers from a range defined with a step size.
The range(n) command, where n>=1, generates a random integer in the range 1, ..., floor(n) (inclusive). There are floor(n) numbers in that range. Hence, it is a selection of one number from a choice of floor(n).
With 2 arguments, range(m,n), where n-m>=0, generates a random integer in the range m, m+1,..., m+q (inclusive) where q is the floor of n-m
With 3 arguments, range(m,n,k), where (n-m)/k=0 generates a random integer in the range m, m+k, ..., m+qk (inclusive) where q is the floor of (n-m)/k. That is, range(n) = range(1,n) = range(1,n,1)
Note: The rint function returns random numbers in the range 0, ..., n-1 (inclusive).
seq⁡MapleTA:-Builtin:-range⁡3,i=1..100
1,2,3
seq⁡MapleTA:-Builtin:-range⁡2,3,i=1..100
2,3
seq⁡MapleTA:-Builtin:-range⁡0,7,3,i=1..100
0,3,6
seq⁡MapleTA:-Builtin:-range⁡0,8,3,i=1..100
seq⁡MapleTA:-Builtin:-range⁡0,9,3,i=1..100
0,3,6,9
seq⁡MapleTA:-Builtin:-range⁡1,10,3,i=1..100
1,4,7,10
The MapleTA[Builtin][range] command was introduced in Maple 18.
For more information on Maple 18 changes, see Updates in Maple 18.
See Also
MapleTA
MapleTA,Builtin,rand
MapleTA,Builtin,rint
Download Help Document
What kind of issue would you like to report? (Optional)