0% found this document useful (0 votes)
13 views22 pages

BANA7030 Random Numbers

The document discusses randomness and stochastic processes, defining key concepts such as system states and types of stochastic processes. It contrasts true random number generators (TRNGs) with pseudorandom number generators (PRNGs), highlighting their applications and characteristics. Additionally, it provides examples of random number generation methods, including Linear Congruential Generators and Lagged Fibonacci Generators, along with their implementations in Python and Excel.

Uploaded by

Baldev Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views22 pages

BANA7030 Random Numbers

The document discusses randomness and stochastic processes, defining key concepts such as system states and types of stochastic processes. It contrasts true random number generators (TRNGs) with pseudorandom number generators (PRNGs), highlighting their applications and characteristics. Additionally, it provides examples of random number generation methods, including Linear Congruential Generators and Lagged Fibonacci Generators, along with their implementations in Python and Excel.

Uploaded by

Baldev Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

Random Numbers

BANA7030
Denise L. White, PhD MBA
Randomness
Randomness is the apparent lack of pattern
or predictability in events. (Wikipedia.com)
Stochastic Processes
Stochastic processes are well defined by a distribution.

T is a parameter and T is the set of possible values for


T
- t can be a set of real numbers or discrete values
Stochastic Processes
Consider the following:

The values that X can take are called system


states and represent possible results of an
experiment.
Types of Stochastic Processes
• Space of States: discrete or continuous

– Discrete:
– Continuous:
Examples
• Bernoulli Process
• Random Walk
• Poisson
Random Number Simulation
• Used many places: video games, cryptography, vaccine trials, forecast
and prediction, etc.
• Pseudorandom: Generated from a computer often using a starting seed.

The difference between true random number generators(TRNGs) and pseudo-


random number generators(PRNGs) is that TRNGs use an unpredictable physical
means to generate numbers (like atmospheric noise), and PRNGs use
mathematical algorithms (completely computer-generated). (researchgate.net)
Pseudorandom Number Generator
Pros Cons
• Replicable • Numbers not
• Fast uniformly distributed
• No large gaps • Discretization of
• Long running period numbers
• Replicate statistical • Incorrect mean or
properties variance
• Cyclical variations
Random Number Generation
• Algorithms are used to generate pseudorandom numbers
• Good behavior of a generate should not be influenced by
the seed
• Pseudorandom Number Generators (PSNG) have periods
– some short and some very long
• Good random number generators are evaluated on their
ability to produce good random numbers and the
operational complexity/strain that they put on the system
Easy random number generators

RANDOM NUMBERS
Linear Congruential Generator
• Generates a series of pseudorandom numbers
using a piecewise linear equation.
• One of the oldest and best known PRNGs.

a is a multiplier (non-negative integer)


c is the increment (non-negative integer)
m is the mod (non-negative integer)
x0 is the initial value (see or non-negative integer)
LCG Example
• a=2
• c=4
• m=5
• x0 = 3
LCG in Python
• Import numpy to allow
mathematical
computation
• Set up variables
• Create loop
• Compute random
value
LCG in Excel
• Set up variables
• Create first x value
using anchored
variables for a, c and
m
• Create 2nd formula that
uses anchored a, c,
and m with previous x
Uniform Distribution
• Used when each element is equally likely
within a defined range of values
• Many simulation models use as a real
number between 0 and 1.
Uniform Distribution

• Utilizes the LCG formula for computing Xn


• Obtained sequence is periodic with period less than or equal to m
• Full period occurs when, m and c are prime numbers
• Learmonth-Lewis generator is commonly used with a = 75, c=0, and
m = 231 - 1
Uniform in Python
• Use the code created
for LCG and modify
value of variables
• Compute u by
dividing x by m
• Print u
Uniform in Excel
• Use your LCG
worksheet and modify
the values of the
variables
• Create new column
for u and set it equal
to x/m
Lagged Fibonacci Generator
• Lagged Fibonacci Generators (LFG) were
created to lengthen the generator period.
• The generator accomplishes this by
looking at the 2 prior values for the
generation.
Evolution of LFG

can be either addition, subtraction, multiplication or X-OR


LFG in Python
• Simple LFG using +
as operator and l=2
and k=1
LFG in Excel
• First x requires use of
seed values
• Second x requires use
of generated x and 2nd
seed value
• Remaining x computed
using 2 prior values

You might also like