MapleTA[Builtin]
rand
generate random real numbers
Calling Sequence
Parameters
Description
Examples
Compatibility
rand(m, n)
rand(m, n, k)
m, n
-
numeric
k
posint
The rand command returns a random real number between m and n (inclusive). For example, to generate random numbers between 0.5 and 9.5, use the formula: rand(0.5, 9.5)
Using the three-argument form, rand returns a random real number between m and n expressed to k significant digits. For example, to generate numbers between 2.73 and 7.91 to two significant figures, use: rand(2.73, 7.91, 2).
Note: In this definition, the dummy variable k represents the number of significant figures, not the step size (as it indicates in defining range and rint). To generate random numbers that vary an order of magnitude and have the same number of decimal digits, use the decimal command in conjunction with the rand command. For example, to generate a random number between 2 and 20 with one decimal place, use: decimal(1, rand(2, 20, 3) )
MapleTA:-Builtin:-rand⁡0.5,9.5
6.871587673
MapleTA:-Builtin:-rand⁡2.73,7.91,2
7.1
The MapleTA[Builtin][rand] command was introduced in Maple 18.
For more information on Maple 18 changes, see Updates in Maple 18.
See Also
MapleTA
MapleTA,Builtin,decimal
MapleTA,Builtin,int
MapleTA,Builtin,range
MapleTA,Builtin,sig
Download Help Document