Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),

Similar presentations


Presentation on theme: "Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),"— Presentation transcript:

1 Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics), human behavior, etc. Testing (large number of cases) Monte Carlo evaluation Run experiments with humans

2 Sources of “randomness” “Digital Chaos”: Deterministic, complicated. Examples: pseudorandom RNGs in code, (UNIX random), cellular automata (http://en.wikipedia.org/wiki/Rule_30),UNIX randomhttp://en.wikipedia.org/wiki/Rule_30 digital slot machines. “Analog Chaos”: Unknown initial conditions. Examples: roulette wheel, dice, card shuffle, analog slot machines. “Truly random”: Quantum mechanics (the world works microscopically).

3 “Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin.” --- John von Neumann (1951)

4 What did von Neumann mean? Distinguish between “random” and “pseudorandom” Big advantage of pseudorandom: repeatability Big disadvantage: not really random

5 The Eudaemons were a small group headed by graduate physics students J. Doyne Farmer and Norman Packard at the University of California Santa Cruz in the late 1970s.... It took two years to develop the computerized system. By 1978 it was working and the group went to Las Vegas to make money at it. Eventually the system was split between two persons: an observer and a bettor. The observer would tap input signals with the foot, the bettor would receive output signals underneath his/her shirt. The average profit was 44% for every dollar. However, there were problems: in one case the insulation failed and the bettor received electric shocks from the solenoids. But she kept placing bets, so the observer, who in this case was Farmer, left the table, so that the bettor would be forced to leave as well. Afterwards it turned out that the solenoid had burned a hole into her skin. Some members of the group had already left because of trouble juggling the academic schedule with the Eudaemonics, but the burning incident caused the two leaders to disband the group Collectively they had managed to make about $10,000. http://en.wikipedia.org/wiki/Eudaemons Real-time Prediction of sectors in roulette

6 Linear Congruential Generator Most common and popular --- simple, fast, pretty good most of the time

7 Choosing good a, c, M [Tez95] gives nec. And suff. Conditions for LCG to have maximal period, M This means we get all the integers in {0, 1, …, (M-1)} in some order before repetition, then periodic But there are dangers lurking, more later

8 Using RNGs Choose an integer i between 1 and N randomly Choose from a discrete probability distribution; example: p(heads) = 0.4, p(tails) = 0.6 Pick a random point in 2-D: square, circle Shuffle a deck of cards

9 “Random number generation is too important to be left to chance.” --- Robert R. Coveyou (1969)

10 Danger and Caveats M, typically MAXINT, too small. For example, if In a million calls the sequence will be repeated about 30 times! Don’t use low-order bits! Points tend to be serially correlated

11 “Random numbers fall mainly in the planes.” --- George Marsaglia (1968) “Every random number generator will fail in at least one application.” --- Donald Knuth (1969)

12 Quick summary of some probability theory Discrete vs. continuous Probability density function f (pdf) Cumulative distribution function F (cdf)

13 Generating other distributions Generate uniformly distributed x Then compute y = g(x), where g( ) is monotically increasing and differentiable Then pdf of y is

14 Important example Exponential distribution

15 Generating a Gaussian: Box-Muller method Generate Then are independent, Gaussian, zero mean, variance 1

16 Neave effect Tails of Box-Muller may be bad H. R. Neave, “On using the Box-Muller transformation with multiplicative congruential pseudorandom number generators,” Applied Statistics, 22, 92-97, 1973.


Download ppt "Using random numbers Simulation: accounts for uncertainty: biology (large number of individuals), physics (large number of particles, quantum mechanics),"

Similar presentations


Ads by Google