
Function Calculations
u“rand” Function
•The “rand” function generates random numbers. If you do not specify an argument, “rand” generates
Specifying two integer values for the argument generates random numbers between them.
Problem | Use this keyboard: |
| Operation | |||
|
|
|
| |||
mth | abc | cat | 2D | |||
|
| |||||
|
|
|
|
|
| |
Generate random numbers |
|
| Func |
| [rand] w | |
between 0 and 1. |
|
|
|
|
| |
|
|
|
|
|
| |
Generate random integers |
|
| Func |
| [rand] 1 ,6 w | |
between 1 and 6. |
|
|
|
|
| |
|
|
|
|
|
|
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 | Use this keyboard: |
| Operation | |||
|
|
|
| |||
mth | abc | cat | 2D | |||
|
| |||||
|
|
|
|
|
| |
Generate a list of three |
|
| Func |
| [randList] 3 w | |
elements that contain |
|
|
|
|
| |
decimal random values. |
|
|
|
|
| |
|
|
|
|
|
| |
Generate a list of five |
|
| Func |
| [randList] 5,1,6 w | |
elements that contain |
|
|
|
|
| |
random values in the range |
|
|
|
|
| |
of 1 through 6. |
|
|
|
|
| |
|
|
|
|
|
|
20050501