How to generate random integers
The random number generator function is called Ran# and can be accessed
in RUN mode by pressing:
[OPTN] [F6] [F3] (PROB) [F4] to access the (Ran#) function
In the paragraph above, the bold text in square brackets indicates keypresses,
while the text in parentheses represents the menus that appear at the
bottom of the calculator screen. This also assumes there are no menus on
the bottom of the screen when you begin. If PROB is already on the
screen, then the [F6] key is not necessary, just press [F3] then [F4] at
this point.
The Ran# function generates a random decimal number
between 0 and 1. If you need to generate a number with a higher range,
then there may be extra steps involved. For example, to choose a random
number between 0 and 100, you would enter:
Ran#×100 or Ran#(100)
Let's
say you want to simulate a dice roll, where you get an integer between 1
and 6. Your first step would be to do:
Ran#×6
This will
give you a random decimal number between 0 and 6. But we need an
integer, not a decimal. To make it an integer, you would change this to:
Int(Ran#×6)
Press [OPTN] [F6] [F4] (NUM) [F2] to access the (Int)
This
now gives you an integer between 0 and 5. We just need to add 1 to the
result.
Int(Ran#×6)+1
The result should be an integer
between 1 and 6.
333 views
Usually answered in minutes!
×