13 Simulation Modeling-Generating Random Numbers
13 Simulation Modeling-Generating Random Numbers
UP Mindanao
of Mathematics
SIMULATION
MODELING
GENERATING RANDOM
NUMBERS
February 6, 2014
Prepared
A
presentation
by: LM
of Estaa
Leo Manuel B. Estaa
AMATMath
110 201
Middle-Square Method
The middle-square method was developed in
1946 by Jon Von Neuman, S. Ulm, and N.
Metropolis at Los Alamos Laboratories to simulate
neutron collisions as part of the Manhattan
Project.
AMAT 110
Middle-Square Method
EXAMPLE:
Pick a seed say x0 = 2041.
Generating 9 random numbers in this way
yields:
AMAT 110
Middle-Square Method
What if you wanted to generate random numbers within the interval say 0 to 1?
Simulation Modeling
AMAT 110
Simulation Modeling
AMAT 110
Methodology
Simulation Modeling
AMAT 110
Simulation Modeling
AMAT 110
Example:
If we set our seed at x0 = 7, we find
x1 = (1 x 7 + 7)mod(10) or 14mod(10), which is
4.
Repeating the same procedure, we obtain the
following sequence: 7, 4, 1, 8, 5, 2, 9, 5, 3, 0,
7, 4, , and the original sequence repeats
again and again.
Simulation Modeling
AMAT 110
Observe that the methodology produces cycling after 10 numbers that is a sequence of integers between 0 and c -1.
Cycling is guaranteed in at most c random numbers in the random number sequence.
The c can be chosen to be very large and a and b chosen in such a way to obtain a full set of c numbers. Many computers use c = 2 31 for the large value of c.
You can scale the random numbers to obtain a sequence between any limits a and b as required.
Simulation Modeling
AMAT 110
Cycling;
Lack of statistical independence among the
members in the list of random numbers.
The sequence will appear independent if
subjected to certain statistical tests which
can be best addressed in a course in
statistics.
Simulation Modeling
AMAT 110
2.
c.
Simulation Modeling
AMAT 110