rand - Maple Help

MapleTA[Builtin]

 rand
 generate random real numbers

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

Parameters

 m, n - numeric k - posint

Description

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

Examples

 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{rand}\left(0.5,9.5\right)$
 ${6.871587673}$ (1)
 > $\mathrm{MapleTA}:-\mathrm{Builtin}:-\mathrm{rand}\left(2.73,7.91,2\right)$
 ${7.1}$ (2)

Compatibility

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