Sample programs
Dice
H->h.mmss
h.mmss->H
|
Dice
This program takes the entered value and generates a random between
1 and that number. To simulate a 6-sided die roll, you would first
tap the "6" button, then "Enter", then the "Dice" program button.
Successive executions do not require entering the
original number again.
Step | Lbl | Action | Note |
1 | | RPN | Set the program to run in RPN mode |
2 | | R<dn> | Roll target value back to X register |
3 | | Enter | Push target value back onto stack |
4 | | Ran# | Generate random number between 0 and 1 |
5 | | x | Multiply by target value |
6 | | 1.00 | Key in the rounding amount. |
7 | | + | Add rounding amount. |
8 | | Int | Take the interger portion. |
9 | | Fix0 | Set the display to show only the whole number. |
10 | | r/s | Stop |
The new random number, scaled from 1 to the initial target value, will be
displayed. The target value is still stored in the Y register, and will
be used for subsequent executions. To change the target value, simply
enter a new number before running the program again.
|