rint - 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]

  

rint

  

return random integers

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

rint(n)

rint(m, n)

rint(m, n, k)

Parameters

m, n, k

-

integer

Description

• 

The rint(n) function generates a random integer in the range 0, ..., n-1 (inclusive). There are n numbers in that range. Hence, it is a selection of one number from a choice of n.

• 

The rint(m,n) function generates a random integer in the range m, ..., n-1 (inclusive).

• 

The rint(m,n,k) function generates a random integer in the range m, m+k, ..., m+qk (inclusive) where q is the largest integer such that m+qk<=n-k. That is, rint(n) = rint(0,n) = rint(0,n,1)

Examples

MapleTA:-Builtin:-rint3

0

(1)

seqMapleTA:-Builtin:-rint3&comma;i=1..100

0&comma;1&comma;2

(2)

MapleTA:-Builtin:-rint1&comma;3

1

(3)

seqMapleTA:-Builtin:-rint1&comma;3&comma;i=1..100

1&comma;2

(4)

MapleTA:-Builtin:-rint0&comma;7&comma;3

3

(5)

seqMapleTA:-Builtin:-rint0&comma;7&comma;3&comma;i=1..100

0&comma;3

(6)

seqMapleTA:-Builtin:-rint0&comma;8&comma;3&comma;i=1..100

0&comma;3

(7)

seqMapleTA:-Builtin:-rint0&comma;9&comma;3&comma;i=1..100

0&comma;3&comma;6

(8)

seqMapleTA:-Builtin:-rint1&comma;10&comma;3&comma;i=1..100

1&comma;4&comma;7

(9)

Compatibility

• 

The MapleTA[Builtin][rint] command was introduced in Maple 18.

• 

For more information on Maple 18 changes, see Updates in Maple 18.

See Also

MapleTA