range - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

MapleTA[Builtin]

 range
 random integers from a range defined with a step size

 Calling Sequence range(n) range(m, n) range(m, n, k)

Parameters

 m, n, k - integer

Description

 • 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).

Examples

 > $\left\{\mathrm{seq}\left(\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{range}\left(3\right),i=1..100\right)\right\}$
 $\left\{{1}{,}{2}{,}{3}\right\}$ (1)
 > $\left\{\mathrm{seq}\left(\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{range}\left(2,3\right),i=1..100\right)\right\}$
 $\left\{{2}{,}{3}\right\}$ (2)
 > $\left\{\mathrm{seq}\left(\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{range}\left(0,7,3\right),i=1..100\right)\right\}$
 $\left\{{0}{,}{3}{,}{6}\right\}$ (3)
 > $\left\{\mathrm{seq}\left(\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{range}\left(0,8,3\right),i=1..100\right)\right\}$
 $\left\{{0}{,}{3}{,}{6}\right\}$ (4)
 > $\left\{\mathrm{seq}\left(\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{range}\left(0,9,3\right),i=1..100\right)\right\}$
 $\left\{{0}{,}{3}{,}{6}{,}{9}\right\}$ (5)
 > $\left\{\mathrm{seq}\left(\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{range}\left(1,10,3\right),i=1..100\right)\right\}$
 $\left\{{1}{,}{4}{,}{7}{,}{10}\right\}$ (6)

Compatibility

 • The MapleTA[Builtin][range] command was introduced in Maple 18.
 • For more information on Maple 18 changes, see Updates in Maple 18.

 See Also