Chapter 2: Main Application 49
u “rand” Function
The “rand” function generates random numbers. If you do not specify an argument, “rand” generates 10-digit
decimal values 0 or greater and less than 1.
Specifying two integer values for the argument generates random numbers between them.
Problem Operation
Generate random numbers between 0 and 1.
[rand] w
Generate random integers between 1 and 6.
[rand] 1 , 6 w
u “randList” Function
Syntax: randList( n [, a, b])
Function:
• Omitting arguments “a” and “b” returns a list of
n elements that contain decimal random values.
• Specifying arguments “a” and “b” returns a list of
n elements that contain integer random values in the range
of “a” through “b”.
Description:
• “
n ” must be a positive integer.
• The random numbers of each element are generated in accordance with “RandSeed” specifications, as with
the “rand” function.
Problem Operation
Generate a list of three elements that contain
decimal random values.
[randList] 3 w
Generate a list of five elements that contain random
values in the range of 1 through 6.
[randList] 5 , 1 , 6 w
u “randNorm” Function
The “randNorm” function generates a 10-digit normal random number based on a specified mean and
standard deviation values.
Syntax: randNorm(
, [, n ])
Function:
• Omitting a value for “
n ” (or specifying 1 for “ n ”) returns the generated random number as-is.
• Specifying a value for “
n ” returns the specified number of random values in list format.
Description:
• “
n ” must be a positive integer, and “ ” must be greater than 0.
Problem Operation
Randomly produce a body length value obtained in
accordance with the normal distribution of a group
of infants less than one year old with a mean body
length of 68 cm and standard deviation of 8.
[randNorm] 8 , 68 w
Randomly produce the body lengths of five infants in
the above example, and display them in a list.
[randNorm] 8 , 68 , 5 w
u “randBin” Function
The “randBin” function generates binomial random numbers based on values specified for the number of trials
n and probability P.
Syntax: randBin( n , P [, m ])