range - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

MapleTA[Builtin]

  

range

  

random integers from a range defined with a step size

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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

seqMapleTA:-Builtin:-range3,i=1..100

1,2,3

(1)

seqMapleTA:-Builtin:-range2,3,i=1..100

2,3

(2)

seqMapleTA:-Builtin:-range0,7,3,i=1..100

0,3,6

(3)

seqMapleTA:-Builtin:-range0,8,3,i=1..100

0,3,6

(4)

seqMapleTA:-Builtin:-range0,9,3,i=1..100

0,3,6,9

(5)

seqMapleTA:-Builtin:-range1,10,3,i=1..100

1,4,7,10

(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

MapleTA

MapleTA,Builtin,rand

MapleTA,Builtin,rint

 


Download Help Document