Random Number Generators CISC/QCSE 810. What is random? Flip 10 coins: how many do you expect will be heads? Measure 100 people: how are their heights.

Slides:



Advertisements
Similar presentations
Generating Random Numbers
Advertisements

Random Number Generation Graham Netherton Logan Stelly.
A Sampling Distribution
Random Number Generation. Random Number Generators Without random numbers, we cannot do Stochastic Simulation Most computer languages have a subroutine,
Probability Distributions CSLU 2850.Lo1 Spring 2008 Cameron McInally Fordham University May contain work from the Creative Commons.
Mathematics in Today's World
CS 351/ IT 351 Modeling and Simulation Technologies Errors In Models Dr. Jim Holten.
Random Numbers. Two Types of Random Numbers 1.True random numbers: True random numbers are generated in non- deterministic ways. They are not predictable.
Chapter 18 Sampling Distribution Models
Event-drive SimulationCS-2303, C-Term Project #3 – Event-driven Simulation CS-2303 System Programming Concepts (Slides include materials from The.
Discrete Event Simulation How to generate RV according to a specified distribution? geometric Poisson etc. Example of a DEVS: repair problem.
Pseudorandom Number Generators
Statistics.
Generating Continuous Random Variables some. Quasi-random numbers So far, we learned about pseudo-random sequences and a common method for generating.
Chapter 14 Simulation. Monte Carlo Process Statistical Analysis of Simulation Results Verification of the Simulation Model Computer Simulation with Excel.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
CSCE Monte Carlo Methods When you can’t do the math, simulate the process with random numbers Numerical integration to get areas/volumes Particle.
Fast integration using quasi-random numbers J.Bossert, M.Feindt, U.Kerzel University of Karlsruhe ACAT 05.
1.  Why understanding probability is important?  What is normal curve  How to compute and interpret z scores. 2.
S519: Evaluation of Information Systems Social Statistics Chapter 7: Are your curves normal?
Random numbers in Python Nobody knows what’s next...
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Random Number Generation Using Low Discrepancy Points Donald Mango, FCAS, MAAA Centre Solutions June 7, CAS/CARe Reinsurance Seminar Baltimore,
Chapter 9 Numerical Integration Numerical Integration Application: Normal Distributions Copyright © The McGraw-Hill Companies, Inc. Permission required.
Random-Number Generation. 2 Properties of Random Numbers Random Number, R i, must be independently drawn from a uniform distribution with pdf: Two important.
ETM 607 – Random Number and Random Variates
Hypothesis Testing II The Two-Sample Case.
1 CE 530 Molecular Simulation Lecture 7 David A. Kofke Department of Chemical Engineering SUNY Buffalo
1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE Prof. C. Heath Turner Lecture 11 Some materials adapted from Prof. Keith E. Gubbins:
Simulation Examples ~ By Hand ~ Using Excel
Statistical Reasoning for everyday life Intro to Probability and Statistics Mr. Spering – Room 113.
Sullivan – Fundamentals of Statistics – 2 nd Edition – Chapter 9 Section 1 – Slide 1 of 39 Chapter 9 Section 1 The Logic in Constructing Confidence Intervals.
Recursion Chapter 7. Chapter Objectives  To understand how to think recursively  To learn how to trace a recursive method  To learn how to write recursive.
Why Is It There? Getting Started with Geographic Information Systems Chapter 6.
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.
1-1 Copyright © 2015, 2010, 2007 Pearson Education, Inc. Chapter 10, Slide 1 Chapter 10 Understanding Randomness.
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.
Monte Carlo Methods1 T Special Course In Information Science II Tomas Ukkonen
Chapter 4 Stochastic Modeling Prof. Lei He Electrical Engineering Department University of California, Los Angeles URL: eda.ee.ucla.edu
Quasi-Monte Carlo Methods Fall 2012 By Yaohang Li, Ph.D.
Probability and Measure September 2, Nonparametric Bayesian Fundamental Problem: Estimating Distribution from a collection of Data E. ( X a distribution-valued.
MATHEMATICAL PROCESSES SPI  I can generate ratios to solve problems involving velocity, density, pressure, and population density.
Chapter Thirteen Copyright © 2004 John Wiley & Sons, Inc. Sample Size Determination.
Validating a Random Number Generator Based on: A Test of Randomness Based on the Consecutive Distance Between Random Number Pairs By: Matthew J. Duggan,
Sampling distributions rule of thumb…. Some important points about sample distributions… If we obtain a sample that meets the rules of thumb, then…
Sampling and estimation Petter Mostad
Random numbers in C++ Nobody knows what’s next....
Chapter 7: The Distribution of Sample Means. Frequency of Scores Scores Frequency.
CS 615: Design & Analysis of Algorithms Chapter 7: Randomized Algorithms (Weiss Chap.: 10.4)
CS774. Markov Random Field : Theory and Application Lecture 15 Kyomin Jung KAIST Oct
Elementary Probability.  Definition  Three Types of Probability  Set operations and Venn Diagrams  Mutually Exclusive, Independent and Dependent Events.
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 16 Mathematics of Normal Distributions 16.1Approximately Normal.
0 Simulation Modeling and Analysis: Input Analysis 7 Random Numbers Ref: Law & Kelton, Chapter 7.
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.
1.  How does the computer generate observations from various distributions specified after input analysis?  There are two main components to the generation.
Statistical principles: the normal distribution and methods of testing Or, “Explaining the arrangement of things”
Statistical Modelling
Basic simulation methodology
Parallel Programming in C with MPI and OpenMP
Random numbers Taken from notes by Dr. Neil Moore
Chapter 4a Stochastic Modeling
Statistics Branch of mathematics dealing with the collection, analysis, interpretation, presentation, and organization of data. Practice or science of.
Chapter 4a Stochastic Modeling
Lecture 2 – Monte Carlo method in finance
Statistical Methods for Data Analysis Random number generators
Sampling Plans.
Presentation transcript:

Random Number Generators CISC/QCSE 810

What is random? Flip 10 coins: how many do you expect will be heads? Measure 100 people: how are their heights distributed? How would you recognize an outlying data point?

True randomness Surprisingly hard to define Best identified by its absence simulate a sequence of events many times (millions) and see if data distribution matches theoretical one bad sequences hard to identify with few (thousands) of samples

Computer Example Sample 100 normally distributed random variables based on population height characteristics

How did it do that?? The computer includes a pseudo- random number generator function

Randomness and Number Theory Surprisingly, most pseudo-random number generators are developed through applications of number theory number theory usually considered the most 'pure' of mathematics also considered the least random! Connection is that integers are well-understood, not rounded off, can generate long, non-repetitive cycles

Congruential Generator Function is linear (so random?) 'randomness' comes from modulus, or 'clock arithmetic' improves (generally) with larger m, and prime m can still be ruined by bad a, b values

Simple Examples a = 10, b = 2, m = 13 a = 769, b = 3, m = 1001 a = 16807, b = 0, m =

Lagged Fibonacci Examples: r = 17, s = 5, N = 2^32 r= 68, s = 33, N = 2^32 Can initialize first part of series with any values Throw away first collection (see graph)

Common features All generate a sequence of pseudo-random numbers must set a 'seed' for the sequence All sequences generate uniformly distributed numbers on [0, N) some real-valued algorithms exist, but generally integer are preferred because of lack of round-off error All will eventually reach back to start of a cycle 2^32 = 4 x 10^9 best case for those shown Converting to [0, 1) range: divide by N

Applications Multivariate numerical integration large number of dimensions Simulating inter-related probabilities Gibbs sampling Direct simulation models with error, randomness molecular simulations Graph simulations binary values represent connections

Integration Simpson's rule, etc. are sufficiently efficient on one, two, three variable problems Problems in 6,7, or higher dimensions, much less so! grid size is to (num intervals)^D Alternative approach: generate random samples from space, take average of function at those points

3D Example: sphere Estimate the volume of the 3D and 10D (hyper)-sphere Take uniform samples on hypercube [-1 1]^3 or [-1 1]^10 Percentage that fall inside sphere (easy to check) represent percent volume of cube inside (hyper)-sphere

Convergence

Quasi-random numbers Pseudo random are best for real randomness last value doesn’t predict value of next For integration in particular, want guarantees of fast coverage of hyper-volumes last value should depend on previous ones Sampling almost on a grid, but able to stop at any point in the sampling Search for Sobol sequences, or low discrepancy sequences (LDS)

2D Example – Halton Sequence

Volume of 6D Sphere

Testing Random Numbers Tests for randomness are usually statistical, and require long sequences (millions of values) Some subtle correlations can occur that can affect simulations some more than others; depends on interpretation of the values (binary, floating point, dimensionality, etc.) See Marsaglia for references and test suites (Diehard suite)

"Physical" randomness Machines exist measure time between radioactive decay events Surprisingly, values from these are often 'less' random than computer- generated ones! Don't take randomness on faith (or advertising)

Summary Randomness is difficult to define Generating sequences of random numbers is not a trivial exercise use references! If possible, develop or borrow tests before you start using a generator