HP 12C#ABA hp 12c_solutions handbook_English_E.pdf - Page 123

Random Number Generator

Page 123 highlights

FV: Unused R1-R.8: Unused 1. Key in the program. 2. Key in m and press R0: n . 3. Key in n and press to calculate mCn. 4. For a new case, go to step 2. Example: A manager wants to choose a committee of three people from the seven engineers working for him. In how many different ways can the committee be selected? Keystrokes Display 7 35.00 7C3. 3 Random Number Generator This HP-12C program calculates uniformly distributed pseudo-random numbers ui in the range 0 < ui < 1. The following method is used: • ui + 1 = fractional part of (997 ui) • where i = 0, 1, 2, ... • u0 = 0.5284163* (seed), *Other seeds may be selected but the quotient of (seed x 107) divided by two or five must not be an integer. Also, it would be wise to statistically test other seeds before using them. ) The period of this generator has a length of 500,000 numbers and the generator passes the frequency test (chi Square) for uniformity, the serial test and the run test. The most significant digits (the left hand digits) are the most random digits. The right most digits are significantly less random. KEYSTROKES DISPLAY CLEAR 5 00- 01- 48 02- 5 122

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165

122
1.
Key in the program.
2.
Key in
m
and press
3.
Key in
n
and press
to calculate
m
C
n
.
4.
For a new case, go to step 2.
Example:
A manager wants to choose a committee of three people from
the
seven engineers working for him. In how many different ways can the
committee be selected?
Random Number Generator
This HP-12C program calculates uniformly distributed pseudo-random
numbers
u
i
in the range
0 <
u
i
< 1.
The following method is used:
u
i
+ 1 = fractional part of (997
u
i
)
where
i
= 0, 1, 2, ...
u
0
= 0.5284163* (seed), *Other seeds may be selected but the quotient of
(seed x 10
7
) divided by two or five must not be an integer. Also, it would be
wise to statistically test other seeds before using them. )
The period of this generator has a length of 500,000 numbers and the
generator passes the frequency test (chi Square) for uniformity, the serial
test and the run test. The most significant digits (the left hand digits) are
the most random digits. The right most digits are significantly less random.
FV: Unused
R
0
:
n
R
1
-R
.8
: Unused
Keystrokes
Display
7
3
35.00
7
C
3
.
KEYSTROKES
DISPLAY
CLEAR
00-
01-
48
5
02-
5