# HP 35s Instruction Manual page 3

Using random numbers for simulations
Also See for HP 35s:

hp calculators
HP 35s Using random numbers for simulations
The first three random numbers are in the range 0.5 <= random number <1, and therefore equate to the
result "heads." The fourth random number is in the range 0 <= random number < 0.5, and is therefore a
result of "tails." Figures 1 through 4 show the display assuming algebraic mode.
Example 2: Nelson's Newstand sells newspapers and has experienced demand for newspapers as follows over the last
50 days: 10 newspapers on 5 of the days; 15 newspapers on 20 of the days; 20 newspapers on 15 of the
days; and 25 newspapers on 10 of the days. Using random numbers and an initial seed of 0.234567,
simulate demand for the next 4 days.
Solution:
The first step will be to translate the past demand into ranges for our random numbers for the simulation.
Out of past 50 days, demand was 10 on 5 of these days, or 10% of the time. Out of the past 50 days,
demand was 15 on 20 of these days, or 40% of the time. Out of the past 50 days, demand was 20 on 15 of
these days, or 30% of the time. Finally, out of the past 50 days, demand was 25 on 10 of the days, or 20%
of the time. This information can be summarized in a table as shown below.
Demand
10
15
20
25
Next, we need to assign a range for each level of demand that corresponds to the relative probability for
that demand. It is this range that will be used to classify each random number as a specific simulated
demand.
Demand
10
15
20
25
Note that each range corresponds to the probability of each outcome (the range between 0.1 and 0.5 is
40% of the possible outcomes of the random numbers and therefore reflects the 40% chance that a
demand of 15 will occur). Store the initial seed and then generate the five random numbers. Evaluate each
random number as it is generated.
In RPN mode:
In algebraic mode: ¹
hp calculators
Probability
0.1
0.4
0.3
0.2
Probability
0.1
0.0 < random number <= 0.1
0.4
0.1 < random number <= 0.5
0.3
0.5 < random number <= 0.8
0.2
0.8 < random number < 1.0
¹
- 3 -
Figure 4
Range
HP 35s Using random numbers for simulations - Version 1.0