UNIFORM RANDOM NUMBER GENERATION Chapter 7 (first half) The goal is to generate a sequence of The goal is to generate a sequence of Uniformly distributed.

Slides:



Advertisements
Similar presentations
RSLAB-NTU Lab for Remote Sensing Hydrology and Spatial Modeling 1 An Introduction to R Pseudo Random Number Generation (PRNG) Prof. Ke-Sheng Cheng Dept.
Advertisements

Spread Spectrum Chapter 7.
Spread Spectrum Chapter 7. Spread Spectrum Input is fed into a channel encoder Produces analog signal with narrow bandwidth Signal is further modulated.
Generating Random Numbers
Random Number Generation Graham Netherton Logan Stelly.
Random Number Generation. Random Number Generators Without random numbers, we cannot do Stochastic Simulation Most computer languages have a subroutine,
 1  Outline  terminating and non-terminating systems  analysis of terminating systems  generation of random numbers  simulation by Excel  a terminating.
 1  Outline  generation of random variates  convolution  composition  acceptance/rejection  generation of uniform(0, 1) random variates  linear.
Random Numbers. Two Types of Random Numbers 1.True random numbers: True random numbers are generated in non- deterministic ways. They are not predictable.
Random Number Generators. Why do we need random variables? random components in simulation → need for a method which generates numbers that are random.
Monte-Carlo Techniques Roger Crawfis. June 9, 2015OSU/CIS 5412 Monte-Carlo Integration Overview 1.Generating Psuedo-Random Numbers 2.Multidimensional.
1 Random Number Generation H Plan: –Introduce basics of RN generation –Define concepts and terminology –Introduce RNG methods u Linear Congruential Generator.
Random Numbers Dick Steflik. Pseudo Random Numbers In most cases we do not want truly random numbers –most applications need the idea of repeatability.
Pseudorandom Number Generators
Statistics.
Random Number Generation
Distinguishing Features of Simulation Time (CLK)  DYNAMIC focused on this aspect during the modeling section of the course Pseudorandom variables (RND)
CSCE Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle.
Random Sampling using RANDOM. Random: Generates a pseudo random number to 3 decimal places that is less than 1. i.e. it generates a random number in the.
1 Simulation Modeling and Analysis Pseudo-Random Numbers.
Properties of Random Numbers
Random-Number Generation. 2 Properties of Random Numbers Random Number, R i, must be independently drawn from a uniform distribution with pdf: Two important.
Random Number Generation Fall 2013
Fall 2011 CSC 446/546 Part 6: Random Number Generation.
Random Number Generation Pseudo-random number Generating Discrete R.V. Generating Continuous R.V.
ETM 607 – Random Number and Random Variates
Simulation of Random Walk How do we investigate this numerically? Choose the step length to be a=1 Use a computer to generate random numbers r i uniformly.
Standard Statistical Distributions Most elementary statistical books provide a survey of commonly used statistical distributions. The reason we study these.
Moment Generating Functions
Modeling and Simulation
Random-Number Generation Andy Wang CIS Computer Systems Performance Analysis.

CS433 Modeling and Simulation Lecture 15 Random Number Generator Dr. Anis Koubâa 24 May 2009 Al-Imam Mohammad Ibn Saud Islamic University College Computer.
© 2003, Carla Ellis Simulation Techniques Overview Simulation environments emulation exec- driven sim trace- driven sim stochastic sim Workload parameters.
CPSC 531: RN Generation1 CPSC 531:Random-Number Generation Instructor: Anirban Mahanti Office: ICT Class Location:
Chapter 7 Random-Number Generation
CS 450 – Modeling and Simulation Dr. X. Topics What Does Randomness Mean? Randomness in games Generating Random Values Random events in real life: measuring.
Module 1: Statistical Issues in Micro simulation Paul Sousa.
Basic Concepts in Number Theory Background for Random Number Generation 1.For any pair of integers n and m, m  0, there exists a unique pair of integers.
Modeling and Simulation Random Number Generators
Random Number Generators 1. Random number generation is a method of producing a sequence of numbers that lack any discernible pattern. Random Number Generators.
Monte Carlo Methods.
Experimental Method and Data Process: “Monte Carlo Method” Presentation # 1 Nafisa Tasneem CHEP,KNU
Random Number Generator. Random number Random number: Uniform distribution on [0,1] Random device: dice, coin -> cannot generate the equal sequence.
Chapter 7 Statistical Inference: Estimating a Population Mean.
Testing Random-Number Generators Andy Wang CIS Computer Systems Performance Analysis.
Random numbers in C++ Nobody knows what’s next....
CHAPTER 5 Simulation Modeling. Introduction In many situations a modeler is unable to construct an analytic (symbolic) model adequately explaining the.
Lab for Remote Sensing Hydrology and Spatial Modeling Dept of Bioenvironmental Systems Engineering National Taiwan University 1/45 GEOSTATISTICS INTRODUCTION.
Invasion Percolation: Randomness Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
The man who knew 28% of mathematics. John Von Neumann ( ) Hans Bethe: Academic seminars (10.
R ANDOM N UMBER G ENERATORS Modeling and Simulation CS
0 Simulation Modeling and Analysis: Input Analysis 7 Random Numbers Ref: Law & Kelton, Chapter 7.
Module 9.2 Simulations. Computer simulation Having computer program imitate reality, in order to study situations and make decisions Applications?
Chapter 3 Generating Uniform Random Variables. In any kind of simulation, we need data, or we have to produce them. Especially in Monte Marco simulation.
MONTE CARLO METHOD DISCRETE SIMULATION RANDOM NUMBER GENERATION Chapter 3 : Random Number Generation.
Random Numbers All stochastic simulations need to “generate” IID U(0,1) “random numbers” Other random variates coming from other distribution can be generated.
1.  How does the computer generate observations from various distributions specified after input analysis?  There are two main components to the generation.
David Luebke 1 6/26/2016 CS 332: Algorithms Linear-Time Sorting Continued Medians and Order Statistics.
Random Numbers All stochastic simulations need to “generate” IID U(0,1) “random numbers” Other random variates coming from other distribution can be generated.
3. Random Number Generator
Random Number Generators
Random-Number Generation
Chapter 7 Random Number Generation
CS 475/575 Slide set 4 M. Overstreet Old Dominion University
Chapter 7 Random-Number Generation
Lecture 2 – Monte Carlo method in finance
Random Number and Random Variate Generation
Computer Simulation Techniques Generating Pseudo-Random Numbers
Random Number Generation
Presentation transcript:

UNIFORM RANDOM NUMBER GENERATION Chapter 7 (first half) The goal is to generate a sequence of The goal is to generate a sequence of Uniformly distributed Uniformly distributed Independent Independent X 1, X 2, …. IID Unif[0, 1] X 1, X 2, …. IID Unif[0, 1] These are the basis of generating all random variates in simulations

UNIFORM [0,1] f(x) x

EARLY METHODS USED PHYSICAL PHENOMENON Spinning disks with digits on them Spinning disks with digits on them Dice (generate on 1/6, 2/6, …, 1) Dice (generate on 1/6, 2/6, …, 1) Picking people out of the phone book Picking people out of the phone book Picking the nth (n = 1200, 1201, …) digit in  Picking the nth (n = 1200, 1201, …) digit in  Gamma ray photon counting Gamma ray photon counting

SEQUENCIAL COMPUTER-BASED METHODS Antique Mid-Square Method (Von Neumann) Antique Mid-Square Method (Von Neumann) Z 0 is a four-digit number Z 0 is a four-digit number Z 1 = middle four digits of Z 0 2 Z 1 = middle four digits of Z 0 2 Z 2 = middle four digits of Z 1 Z 2 = middle four digits of Z 1 U i = Z i /10000 U i = Z i /10000

SAMPLE MID-SQUARE iZiZi^2Ui

MID-SQUARE PROPERTIES Once you know a Z, you can accurately predict the entire future sequence (not really random) Once you know a Z, you can accurately predict the entire future sequence (not really random) If a Z ever repeats, the whole sequence starts over If a Z ever repeats, the whole sequence starts over Only generate 9999 numbers (not dense in [0, 1] Only generate 9999 numbers (not dense in [0, 1] Turns out, we LIKE some of these properties for computer simulations (Repeatability enables debugging)

DESIRABLE PROPERTIES Appear Unif[0, 1] Appear Unif[0, 1] Fast algorithm Fast algorithm Reproducible stream Reproducible stream Debugging Debugging Contrast in comparison (Variance Reduction) Contrast in comparison (Variance Reduction) Lots of numbers before a repeat Lots of numbers before a repeat

LINEAR CONGRUENTIAL GENERATOR (Lehmer, 1954) Z 0 is the SEED Z 0 is the SEED m is the MODULUS m is the MODULUS a is the MULTIPLIER a is the MULTIPLIER c is the INCREMENT (forget this one) c is the INCREMENT (forget this one)

PROPERTIES Can generate at most m-1 samples before repeat Can generate at most m-1 samples before repeat Length of non-repeating sequence called the PERIOD of the generator Length of non-repeating sequence called the PERIOD of the generator If you get m-1, you have a full cycle generator If you get m-1, you have a full cycle generator Divides [0, 1] into m equal slices Divides [0, 1] into m equal slices

unif.xls observe the basic functions of the seed, multiplier, and modulus observe the basic functions of the seed, multiplier, and modulus experiment with multipliers for experiment with multipliers for m = 17 m = 17 m = 16 m = 16

HISTORY Necessary for full cycle Necessary for full cycle a and m relatively prime a and m relatively prime q (prime) divides m and a-1 q (prime) divides m and a-1 m = 2,147,483,648 = is everybody’s favorite 32-bit generator (SIMAN, SIMSCRIPT, GPSS/H, Arena) m = 2,147,483,648 = is everybody’s favorite 32-bit generator (SIMAN, SIMSCRIPT, GPSS/H, Arena) Fishman, G. S. (1972). An Exhaustive Study of Multipliers for Modulus , RAND Technical Series. Fishman, G. S. (1972). An Exhaustive Study of Multipliers for Modulus , RAND Technical Series. a = 630,360,647 a = 630,360,647

HISTORICAL COMPETITION FOR LINEAR CONGRUENTIAL GENERATORS add or multiply some combination of variates from the stream’s recent history add or multiply some combination of variates from the stream’s recent history

WHAT IS GOOD Full, Long Cycle Full, Long Cycle Seemingly Independent Seemingly Independent We can test this, but our simple tests stink We can test this, but our simple tests stink

 2 Test for U[0, 1] U 1, U 2,...U n a sequence of U[0, 1] samples U 1, U 2,...U n a sequence of U[0, 1] samples Let us divide [0, 1] into k equally-sized intervals Let us divide [0, 1] into k equally-sized intervals Let o i = observations in [(i-1)/k, i/k] Let o i = observations in [(i-1)/k, i/k] e i = n/k is the expected number of U i ’s that fall in [(i-1)/k, i/k] for each i e i = n/k is the expected number of U i ’s that fall in [(i-1)/k, i/k] for each i

TESTING  n  2 follows the Chi-Squared distribution with n- 1 degrees of freedom  n  2 follows the Chi-Squared distribution with n- 1 degrees of freedom DUMB TEST DUMB TEST any full-cycle generator is exactly AOK any full-cycle generator is exactly AOK expand to two or more dimensions using n- tuples (U i, U i+1,..., U i+n ) expand to two or more dimensions using n- tuples (U i, U i+1,..., U i+n ) maybe a picture would be better? maybe a picture would be better?