Random numbers and generators

Size: px
Start display at page:

Download "Random numbers and generators"

Transcription

1

2 Chapter 2 Random numbers and generators Random numbers can be generated experimentally, like throwing dice or from radioactive decay measurements. In numerical calculations one needs, however, huge set of random numbers and this make gambling not practical. For that reason one relies on so-called Pseudo Random Numbers. Pseudo random numbers are not really random in the common day notion. They are generated by algorithms such that their statistical properties follow as close as possible those of truly random numbers. For that reason many different algorithms and many different tests for randomness have been designed. There are algorithms for many different distributions. The working horses, however, are algorithms to produce random numbers uniformly distributed in the interval [0, 1] such that the probability P(0 a x b 1) = b a. Random numbers produced by computer programs should be statistically reliable (i.e. pass statistics tests); have long periods (on a finite computer any generator will have some period, but it should be much longer than any number of random numbers used in the analysis); long are periods larger than 2 60 ; reproducible, i.e., give the same sequences when started from the begin in order to allow to repeat calculations; restartable, i.e., there should be a method to save the current status and restart from that at some later time; portable, should give identical results for different computer architectures and compiler.; efficient (fast), since one needs (very) many random numbers; 13

3 14 CHAPTER 2. RANDOM NUMBERS AND GENERATORS have disjoint subsets, since ideally one wants to use them in parallel machines; Finally one should take serious the warning reiterated in Press book Numerical Recipes [PrTeVe99]. The random number generators supplied by standard compilers (including the ANSI standard) are usually not good and with relatively small periods. If you really want to do scientifically sound work and need many random number (more than a few thousand) please rely on better algorithms (like RANLUX discussed further down). Different ideas are pursued by so-called Quasi Random Number Generators. There one constructs sequences of numbers filling a d-dimensional hypercube as uniform as possible, more uniform then pseudo random numbers. Such algorithms exist for moderately small dimensions (cf. [PrTeVe99]).

4 2.1. LINEAR CONGRUENTIAL GENERATORS Linear congruential generators This is simple, fast, restartable but with small periods and not reliable. Its simplest form (D. Lehmer: 1948) is based on integer multiplication and addition: where x n+1 = (a x n + c) mod m (2.1) a multiplier 0 a < m m modulus 0 < m c increment 0 c < m x 0 start value 0 x 0 < m (2.2) This gives a sequence of numbers between 0 and m. From this one computes real random numbers with r n = x n /m [0, 1). (2.3) Obviously the maximum period is m. The value of c is often chosen to be zero. Originally one used values of m that are powers of 2, since then the modulo operation amounts to a truncation of the binary representation of the number. A notorious bad choice was IBM s very first random number generator RANDU with a = 65539, c = 0 and m = It proved to have bad correlations. For such choices Knuth [Kn81] claims the best alternative is a = , c = 0 and m = The period depends very much on the seed x 0. For instance for the last mentioned values the period varies between 2 17 for seed 123 and 2 24 for seed values 0, 2, 124. Somewhat better choices seem to be those of l Ecuyer a = , c = 0, m = Park-Miller a = 7 5 = 16807, c = 0, m = (2.4) Whenever one uses a choice with c = 0 this is also a fixed point of the algorithm and thus one has to avoid it (check for that value). Algorithmic detail: A problem associated with the implementation of such random number algorithms in higher-level languages is that the multiplication would lead to overflows, numbers larger than the largest allowed integer. A method to multiply two 32-bit integers modulo a 32-bit constant in 32-bit arithmetic has been suggested by Schrage. It is based on approximate factorization of m, m = a q + r where q = [m/a], r = m moda. (2.5)

5 16 CHAPTER 2. RANDOM NUMBERS AND GENERATORS If r < q and a number 0 < z < m 1 then both and then { az mod m = a(z mod q) {0, 1,...m 1}, r[z/q] {0, 1,...m 1}. a(z modq) r[z/q] if this is 0, a(z modq) r[z/q] + m otherwise. (2.6) (2.7) For the Park-Miller numbers this gives m = = , a = 7 5 = 16807, q = [m/a] = , r = Problem: Implement the Park-Miller algorithm and compute a sequence of real numbers [0, 1). Estimate mean value, variance and higher moments. Plot ( X k N 1/(k + 1)) N vs. 1/N; what do you observe? Problem: One could formulate the linear congruential generator also for real numbers x n [0, 1), using m = 1.0 and defining the modulo operation via x mod 1 = x [x]. What values of a and c are possible? Implement this and compute mean value and several moments. For the linear congruential method the random numbers are correlated in subtle ways. If one considers tuples of k subsequent numbers as representing a point in k-dimensional space (r 1,r 2,...r k ), the points often fill parallel k 1- dimensional planes in the k-dimensional hypercube. This will be discussed when we present tests in Section

6 2.2. FIBONACCI TYPE GENERATORS Fibonacci type generators The Fibonacci sequence 1, 1, 2, 3, 5, 8, 13, 21, comes from starting with the numbers 1 and 1 and finding the next number by adding the preceeding two. If we add the number modulo 10 we get the sequence a random sequence (is it?) of integers. 1, 1, 2, 3, 5, 8, 3, 1, 4, 5, 9, 4,... Problem: Do you find a cycle in the modified Fibonacci sequence of integer numbers {0, 1, 2,...,9}? This gives rise to another method to construct pseudo random number: x n+1 = (x n + x n 1 ) mod m. (2.8) This allows much larger periods than just m. Implementation is also possible for real numbers [0, 1] if m = 1.0 and the modulo operation is understood accordingly x mod 1 = x [x]. More general we speak of a Lagged Fibonacci sequence for x n+1 = (x n p x n q ) mod m, (2.9) where denotes a binary operation (like addition or subtraction or some logical operation). For careful choices of p and q one can achieve a period up to (2 p 1)(2 q 1). An often used choice of values is p = 24 and q = 55. For its implementation one has to keep an array of length 55 in memory, which can be reused cyclically. To start (or restart) the generator one needs this array. For the first start one can build such an array with help of a simple linear congruential generator. A variant of the lagged Fibonacci generator is called Shift Register Generator. It uses the logical operation exclusive or (XOR) for the operation. For two bits a and b the corresponding multiplication table for the resulting a XOR b is a\ b Each new (signed) 32-bit integer number is thus computed by this operation (for each of the 32 bits) from two other, earlier computed integers. E.g. for p = 147 and q = 250 the new number could be

7 18 CHAPTER 2. RANDOM NUMBERS AND GENERATORS x(n-147) x(n-250) x(n) Each number is interpreted as a signed integer x [ m,m] with m = Since the sign is also random, one just adds m, it the number is negative, before normalizing to get a real number in [0, 1]. The Marsaglia-Zaman Generator[MaZa94] is a lagged Fibonacci (subtraction) generator with a so-called carry bit: = x n p x n q c n 1, x n =, c n = 0 if 0, x n = + m, c n = 1 if < 0. (2.10) The resulting random numbers are in [0,m]. For p = 10, r = 24 and m = 2 24 one find periods O( ). A particularly efficient and well tested generator of that type, but introducing extra holes in the sequence, is RANLUX (by Lüscher [Lu94], see also [Ja94]). It exists for C and F90, single and double precision, suitable for computing long vectors of random numbers and portable to all computers with IEEE-754 compliance. Since 1998 another popular pseudorandom number generator is the Mersenne Twister by Matsumoto and Nishimura. The name stems form the period which is chosen as a Mersenne prime number. After some time (longer than for the lagged Fibonacci) high-quality random numbers are produced. A drawback is that form a sequence of, e.g., 624 (for the variant MT19937) all future numbers can be predicted, thus it is unusable for cryptography. Further improvement of the quality of generators comes from combining different generators, reshuffling random numbers and reshuffling the seed tables. Finally here a quote from Marsaglia: Random number generators are like sex: when it s good, it s wonderful, when it s bad it s still pretty good.

8 2.3. TESTING RANDOM NUMBER QUALITY Testing random number quality Intelligence is what the IQ-tests test. In that sense we use statistical tests to probe the quality of pseudo random number generators. In this section we assume that the random numbers should be uniformly distributed and x n [0, 1] Simple tests These are the usual statistical tests, i.e., computation of moments. For a uniform distribution one expects X k = 1 N N i=1 x k i = 1 k O(1/ N). (2.11) Even if these are correct, the numbers may be correlated (statistically not independent). This can be checked by computing the autocorrelation (see Chapter 5) function. Again, for a uniform distribution of uncorrelated numbers one expects If this is not the case, we expect X n X n+k = X n 2 = 1 4. (2.12) X n X n+k X n X n+k exp( k/ξ), (2.13) where ξ denotes the correlation length. This is discussed in detail in Chapter 6. A trivial test is for symmetry. Instead of the sequence (X n ) we take (1 X n ). The results should still be that of a uniform distribution. Another, graphical, test (which will be elaborated in more detail in Section 2.3.4) is pairing subsequent numbers (x i,x i+1 considering them as points in the unit square. Do they fill up the square uniformly (inspection by eye)? This test is also called parking-lot test for obvious reasons χ 2 -test This is a test for the distribution density directly. One first builds (from the random number sequence) a histogram of values and then compares the histogram with the expected distribution density function. Fig. 2.1 gives examples of such histograms for a (hopefully) uniform distribution. How did we construct it? Decide on the number of bins nbins (e.g. 100) and initialize a histogram array h(1:nbins)=0. The bin size is 1/nbins.

9 20 CHAPTER 2. RANDOM NUMBERS AND GENERATORS N = N = N = Figure 2.1: Histograms for 10 5, 10 6 and 10 7 uniformly distributed random numbers (produced with the intrinsic routine F90-routine RANDOM NUMBER under Intel ifort v9.0). Compute N random numbers. For each compute first the slot (bin number i) by i=[r/binsize]+1 where [n] denotes the largest integer in n. Add 1 to the bin entry: h(i)=h(i)+1. At the end normalize the histogram to total area 1, i.e. h=h/(binsize*nran). How to estimate the quality of the resulting histogram? We first define a norm for the difference by adding the squares of the differences between the histogram values and the values of the tested distribution density (computed at the central values of the respective bins): χ 2 bins i (y i n th,i ) 2 The theoretically expected number of hits in a bin is where n th,i = f i n ran d i, n th,i. (2.14) n ran n bins y i n th,i f i is the number of random numbers is the number of bins is the number of hits in bin number i is the expected number of hits in bin number i is the value of f(x) at the central value of the bin d i is the width of bin number i with i d i f i = 1. (2.15)

10 2.3. TESTING RANDOM NUMBER QUALITY 21 With this we find another representation of χ 2 1 n ran y 2 i f i d i n ran. (2.16) The value of χ 2 determines the likelihood of the fit, in this case of the quality of the representation of the correct distribution in n bins bins. It follows a χ 2 -distribution of ν n bins 1 degrees of freedom. Its most likely value is ν, other values have to read from tables (or evaluation) of the distribution F χ 2(ν,x). This distribution has mean value ν and variance 2ν. E.g. for 100 bins one finds P(χ 2 113) = F χ 2(99, 113) = meaning that values below 113 are quite probably, larger values would be worrysome Kolmogorov-Smirnov Test Whereas the χ 2 -test needs binning (or discrete distributions) the Kolmogorov- Smirnov test works for continuous random variables. Given such a set of numbers one computes the maximum distance (at any point) between the cumulative distribution F(x) and the function constructed from the data: F n (x) = number of x i below x, i.e. x i x n. (2.17) This is a function with n steps, but if the set of random numbers is sorted increasingly then the maximum distance D obs = max F n (x) F(x) (2.18) can be computed easily. For n data points the probability to get some D is P(D > D obs ) = Q KS ( D ( ( n / n )). (2.19) The positive function Q KS is monotonically decreasing from Q KS (0) = 1 to Q KS ( ) = 0 and given by Q KS (z) = 2 ( 1) j 1 e 2j2 z 2. (2.20) j=1 It is found in tables (or can be calculated).

11 22 CHAPTER 2. RANDOM NUMBERS AND GENERATORS Figure 2.2: The random numbers of the mentioned generator (a = 137, c = 187 and m = 256) are aligned in 2-d plots! Spectral test This is an impressive visual test. One identifies k subsequent random numbers with the coordinates of a point in a k-dimensional hypercube. A simple example is shown in Fig The linear congruential algorithm with a = 137, c = 187 and m = 256 gives its number-pairs arranged along parallel lines. Sometimes one has to compute many numbers in order to exhibit this feature. Fig. 2.3 shows a small patch of the unit square produced in a run of 10 9 number for the generator with a = 16897, c = 0 and m = For linear congruential generators often such an arrangement of parallel k.1- dimensional hyperplanes is found when plotting k-tuples. Another example is Fig. 2.4, where the parameters a = 65539, c = 0 and m = There triples of numbers were used as points in a cube. Here is the MATHEMATICA code for that example: ApRandom := (Rannew = Ranold 65539; Ranold = Mod[Rannew, 32768]; Return[Ranold/32768]) Ranold = pts = Table[Point[{ApRandom, ApRandom, ApRandom}], {2000}] Show[Graphics3D[pts, ViewPoint -> {-1.529, 1.578, 2.573}]] The distance between such neighboring planes can be used to formulate the spectral test, described in more detail in Knuth s book [Kn81].

12 2.3. TESTING RANDOM NUMBER QUALITY Figure 2.3: Some numbers out of a run with 10 9 of the generator (a = 16897, c = 0 and m = ) are aligned! Figure 2.4: Triples of random numbers produced with a linear congruential generator (a = 65539, c = 0 and m = 2 16 ) fill parallel planes.

13 24 CHAPTER 2. RANDOM NUMBERS AND GENERATORS Problem: For the linear congruential generator with a = 65539, c = 0 and m = 2 16 do the spectral test for D = 3. Then use a = and m = and compare the result.

14 2.4. NON-UNIFORM DISTRIBUTIONS 25 y M f ( x) X nein ja 0 a r 1 b x Figure 2.5: Rejection method: If r 2 f(r 1 ) (with r 1 (a,b) and r 2 (0,M) uniformly distributed), then r 2 is accepted. 2.4 Non-uniform distributions Often one wants random numbers with a particular distribution. Although a Metropolis method like discussed in Chapter 4 is possible, depending on the distribution other approaches may be more efficient. Some distributions can be achieved by special tricks: X = max(x 1,X 2 ) has the distribution F 1 (x)f 2 (x). X = min(x 1,X 2 ) has the distribution F 1 (x) + F 2 (x) F 1 (x)f 2 (x). Due to this we may easily construct some distributions with help of a set of uniformly distributed random number u i : X = max(u 1,U 2 ) F(X) = x 2, f(x) = 2x, X = max(u 1,U 2,...U t ) F(X) = x t, f(x) = t x t 1. (2.21) Rejection method This is discussed in more detail in Chapter 4. The distribution density function f(x) is embedded in a bounding rectangle (a,b) (A,B) and a random number r 1 chosen uniformly (a,b) is accepted if r 2 f(r 1 ) for another random number r 2 chosen uniformly (A,B). (See Fig. 2.5.) A variant of this is the Metropolis algorithm, also discussed in Chapter 4.

15 26 CHAPTER 2. RANDOM NUMBERS AND GENERATORS u F(x) r x Figure 2.6: Uniformly distributed random numbers u lead to random numbers x with distribution density f(x) Inversion method The normalized probability density distribution f(x) defines the distribution function F X (x) = P(X x) = x dx f X (x). (2.22) It raises monotonically from F( ) = 0 to F( ) = 1. The crucial observation is: If a random variable Y is uniformly distributed, then X = F 1 (Y ) has the distribution density f(x). To show this we use the relation for the distribution of a function of a random variable. If a random variable y has the distribution density f Y (y) then the random variable X g(y ) has the density f X (x) = i where the sum runs over all points y i where x = g(y i ). In our case f Y = 1 in the unit interval. Furthermore x = g(y) = F 1 X (y) y = F X(x) dy dx = f X(x) = which is just (2.23). The method is exemplified in Fig. 2.6: f Y (y i (x)) g (y i (x)), (2.23) 1. Find a random number u uniformly distributed in (0, 1). ( ) 1 dy = 1 dx g (y) (2.24) 2. Compute x = F 1 (u) where F 1 is the inverse distribution function. 3. Then x has the distribution density f(x). The crucial problem usually is to invert F(x). If this is not possible analytically (and often it is not), then tabulation of F and piecewise interpolation can help.

16 2.4. NON-UNIFORM DISTRIBUTIONS 27 Simple examples are X = U 1/t F(x) = x t, X = ln U F(x) = exp( x). (2.25) Please take care of the normalization depending on the interval applicable! Gaussian normal distribution This is very often needed and there is an efficient method [BoMuMa58] to get such random variable. 1. Compute two random numbers r 1, r 2 uniformly distributed in (0, 1), and map them to ( 1, 1) with u i = 2r i Compute s = u u 2 2. If s 1 then reject this pair and start again above. If s < 1 continue with the next step. 3. Compute the pair of numbers x 1 = u 1 2 ln s s, x 2 = u 2 2 ln s s. (2.26) These two numbers are independent (!) and normally distributed with mean 0 and variance 1. The only disadvantage of this algorithm is that one has to compute logarithm and square root. Problem: Simulate radioactive decay. For N(t) not yet decayed nuclei during t the number of decaying nuclei is N(t) = N(t)λ t. This is simulated in the following way: In each time step t = 1 the number N(t) is reduced by 1 if a random number r (uniform in (0,1) is smaller than λ (for a choice 0 < λ < 1). Plot N(t) and log N(t) as functions of t/λ. Study values of N(0) = 10, 100, Do the functions depend on the starting value?

17 28 CHAPTER 2. RANDOM NUMBERS AND GENERATORS Bibliography BoMuMa58 G.E.P. Box, M.E. Muller and G. Marsaglia, Ann. Math. Stat. 28 (1958) 610. Ja90 F. James, Comp. Phys. Comm. 60 (1990) 329 Ja94 F. James, Comp. Phys. Comm. 79 (1994) 111; ibid. 97 (1996) 357. Kn81 D.E. Knuth, The art of computer programming, vol. 2 Lu94 M. Lüscher, Comp. Phys. Comm. 79 (1994) 100. Ma85 G. Marsaglia, in Computer Science and Statistics: The Interface; ed. C. Billard (Elsevier: 1985) MaZa94 G. Marsaglia and A. Zaman, Computers in Physics 8 (1994) 117. PrTeVe99 W. H. Press et al., Numerical Recipes, 2nd ed. (Cambridge UP: 1999) (Addison-Wesley, Reading, MA: 1981).

A Repetition Test for Pseudo-Random Number Generators

A Repetition Test for Pseudo-Random Number Generators Monte Carlo Methods and Appl., Vol. 12, No. 5-6, pp. 385 393 (2006) c VSP 2006 A Repetition Test for Pseudo-Random Number Generators Manuel Gil, Gaston H. Gonnet, Wesley P. Petersen SAM, Mathematik, ETHZ,

More information

Random Number Generators - a brief assessment of those available

Random Number Generators - a brief assessment of those available Random Number Generators - a brief assessment of those available Anna Mills March 30, 2003 1 Introduction Nothing in nature is random...a thing appears random only through the incompleteness of our knowledge.

More information

Review of Statistical Terminology

Review of Statistical Terminology Review of Statistical Terminology An experiment is a process whose outcome is not known with certainty. The experiment s sample space S is the set of all possible outcomes. A random variable is a function

More information

2008 Winton. Review of Statistical Terminology

2008 Winton. Review of Statistical Terminology 1 Review of Statistical Terminology 2 Formal Terminology An experiment is a process whose outcome is not known with certainty The experiment s sample space S is the set of all possible outcomes. A random

More information

Random processes and probability distributions. Phys 420/580 Lecture 20

Random processes and probability distributions. Phys 420/580 Lecture 20 Random processes and probability distributions Phys 420/580 Lecture 20 Random processes Many physical processes are random in character: e.g., nuclear decay (Poisson distributed event count) P (k, τ) =

More information

Generating Uniform Random Numbers

Generating Uniform Random Numbers 1 / 43 Generating Uniform Random Numbers Christos Alexopoulos and Dave Goldsman Georgia Institute of Technology, Atlanta, GA, USA March 1, 2016 2 / 43 Outline 1 Introduction 2 Some Generators We Won t

More information

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint Chapter 4: Monte Carlo Methods Paisan Nakmahachalasint Introduction Monte Carlo Methods are a class of computational algorithms that rely on repeated random sampling to compute their results. Monte Carlo

More information

Generating Uniform Random Numbers

Generating Uniform Random Numbers 1 / 41 Generating Uniform Random Numbers Christos Alexopoulos and Dave Goldsman Georgia Institute of Technology, Atlanta, GA, USA 10/13/16 2 / 41 Outline 1 Introduction 2 Some Lousy Generators We Won t

More information

Uniform Random Number Generators

Uniform Random Number Generators JHU 553.633/433: Monte Carlo Methods J. C. Spall 25 September 2017 CHAPTER 2 RANDOM NUMBER GENERATION Motivation and criteria for generators Linear generators (e.g., linear congruential generators) Multiple

More information

Generating Uniform Random Numbers

Generating Uniform Random Numbers 1 / 44 Generating Uniform Random Numbers Christos Alexopoulos and Dave Goldsman Georgia Institute of Technology, Atlanta, GA, USA 10/29/17 2 / 44 Outline 1 Introduction 2 Some Lousy Generators We Won t

More information

Pseudo-Random Numbers Generators. Anne GILLE-GENEST. March 1, Premia Introduction Definitions Good generators...

Pseudo-Random Numbers Generators. Anne GILLE-GENEST. March 1, Premia Introduction Definitions Good generators... 14 pages 1 Pseudo-Random Numbers Generators Anne GILLE-GENEST March 1, 2012 Contents Premia 14 1 Introduction 2 1.1 Definitions............................. 2 1.2 Good generators..........................

More information

Modern Methods of Data Analysis - WS 07/08

Modern Methods of Data Analysis - WS 07/08 Modern Methods of Data Analysis Lecture III (29.10.07) Contents: Overview & Test of random number generators Random number distributions Monte Carlo The terminology Monte Carlo-methods originated around

More information

Finally, a theory of random number generation

Finally, a theory of random number generation Finally, a theory of random number generation F. James, CERN, Geneva Abstract For a variety of reasons, Monte Carlo methods have become of increasing importance among mathematical methods for solving all

More information

Class 12. Random Numbers

Class 12. Random Numbers Class 12. Random Numbers NRiC 7. Frequently needed to generate initial conditions. Often used to solve problems statistically. How can a computer generate a random number? It can t! Generators are pseudo-random.

More information

Random Number Generation. Stephen Booth David Henty

Random Number Generation. Stephen Booth David Henty Random Number Generation Stephen Booth David Henty Introduction Random numbers are frequently used in many types of computer simulation Frequently as part of a sampling process: Generate a representative

More information

Monte Carlo Techniques

Monte Carlo Techniques Physics 75.502 Part III: Monte Carlo Methods 40 Monte Carlo Techniques Monte Carlo refers to any procedure that makes use of random numbers. Monte Carlo methods are used in: Simulation of natural phenomena

More information

How does the computer generate observations from various distributions specified after input analysis?

How does the computer generate observations from various distributions specified after input analysis? 1 How does the computer generate observations from various distributions specified after input analysis? There are two main components to the generation of observations from probability distributions.

More information

Random Number Generation. CS1538: Introduction to simulations

Random Number Generation. CS1538: Introduction to simulations Random Number Generation CS1538: Introduction to simulations Random Numbers Stochastic simulations require random data True random data cannot come from an algorithm We must obtain it from some process

More information

CPSC 531: Random Numbers. Jonathan Hudson Department of Computer Science University of Calgary

CPSC 531: Random Numbers. Jonathan Hudson Department of Computer Science University of Calgary CPSC 531: Random Numbers Jonathan Hudson Department of Computer Science University of Calgary http://www.ucalgary.ca/~hudsonj/531f17 Introduction In simulations, we generate random values for variables

More information

Systems Simulation Chapter 7: Random-Number Generation

Systems Simulation Chapter 7: Random-Number Generation Systems Simulation Chapter 7: Random-Number Generation Fatih Cavdur fatihcavdur@uludag.edu.tr April 22, 2014 Introduction Introduction Random Numbers (RNs) are a necessary basic ingredient in the simulation

More information

( ) ( ) Monte Carlo Methods Interested in. E f X = f x d x. Examples:

( ) ( ) Monte Carlo Methods Interested in. E f X = f x d x. Examples: Monte Carlo Methods Interested in Examples: µ E f X = f x d x Type I error rate of a hypothesis test Mean width of a confidence interval procedure Evaluating a likelihood Finding posterior mean and variance

More information

Numerical methods for lattice field theory

Numerical methods for lattice field theory Numerical methods for lattice field theory Mike Peardon Trinity College Dublin August 9, 2007 Mike Peardon (Trinity College Dublin) Numerical methods for lattice field theory August 9, 2007 1 / 37 Numerical

More information

How does the computer generate observations from various distributions specified after input analysis?

How does the computer generate observations from various distributions specified after input analysis? 1 How does the computer generate observations from various distributions specified after input analysis? There are two main components to the generation of observations from probability distributions.

More information

Uniform random numbers generators

Uniform random numbers generators Uniform random numbers generators Lecturer: Dmitri A. Moltchanov E-mail: moltchan@cs.tut.fi http://www.cs.tut.fi/kurssit/tlt-2707/ OUTLINE: The need for random numbers; Basic steps in generation; Uniformly

More information

Contents. 1 Probability review Introduction Random variables and distributions Convergence of random variables...

Contents. 1 Probability review Introduction Random variables and distributions Convergence of random variables... Contents Probability review. Introduction..............................2 Random variables and distributions................ 3.3 Convergence of random variables................. 6 2 Monte Carlo methods

More information

Slides 3: Random Numbers

Slides 3: Random Numbers Slides 3: Random Numbers We previously considered a few examples of simulating real processes. In order to mimic real randomness of events such as arrival times we considered the use of random numbers

More information

Lehmer Random Number Generators: Introduction

Lehmer Random Number Generators: Introduction Lehmer Random Number Generators: Introduction Revised version of the slides based on the book Discrete-Event Simulation: a first course LL Leemis & SK Park Section(s) 21, 22 c 2006 Pearson Ed, Inc 0-13-142917-5

More information

UNIT 5:Random number generation And Variation Generation

UNIT 5:Random number generation And Variation Generation UNIT 5:Random number generation And Variation Generation RANDOM-NUMBER GENERATION Random numbers are a necessary basic ingredient in the simulation of almost all discrete systems. Most computer languages

More information

Random Number Generators

Random Number Generators 1/18 Random Number Generators Professor Karl Sigman Columbia University Department of IEOR New York City USA 2/18 Introduction Your computer generates" numbers U 1, U 2, U 3,... that are considered independent

More information

B.N.Bandodkar College of Science, Thane. Random-Number Generation. Mrs M.J.Gholba

B.N.Bandodkar College of Science, Thane. Random-Number Generation. Mrs M.J.Gholba B.N.Bandodkar College of Science, Thane Random-Number Generation Mrs M.J.Gholba Properties of Random Numbers A sequence of random numbers, R, R,., must have two important statistical properties, uniformity

More information

Tae-Soo Kim and Young-Kyun Yang

Tae-Soo Kim and Young-Kyun Yang Kangweon-Kyungki Math. Jour. 14 (2006), No. 1, pp. 85 93 ON THE INITIAL SEED OF THE RANDOM NUMBER GENERATORS Tae-Soo Kim and Young-Kyun Yang Abstract. A good arithmetic random number generator should possess

More information

Sum-discrepancy test on pseudorandom number generators

Sum-discrepancy test on pseudorandom number generators Sum-discrepancy test on pseudorandom number generators Makoto Matsumoto a,, Takuji Nishimura b a Faculty of Science, Hiroshima University, Hiroshima 739-8526, JAPAN b Faculty of Science, Yamagata University,

More information

arxiv:hep-lat/ v2 10 Aug 1993

arxiv:hep-lat/ v2 10 Aug 1993 1 A Comparative Study of Some Pseudorandom Number Generators I. Vattulainen 1, K. Kankaala 1,2, J. Saarinen 1, and T. Ala-Nissila 1,3 arxiv:hep-lat/9304008 v2 10 Aug 1993 1 Department of Electrical Engineering

More information

From Mersenne Primes to Random Number Generators

From Mersenne Primes to Random Number Generators From Mersenne Primes to Random Number Generators Richard P. Brent MSI & RSISE ANU 8 May 2006 Advanced Computation seminar, ANU. Copyright c 2006, the author. AdvCom1t Abstract Fast and reliable pseudo-random

More information

Stochastic Simulation of Communication Networks

Stochastic Simulation of Communication Networks Stochastic Simulation of Communication Networks Part 2 Amanpreet Singh (aps) Dr.-Ing Umar Toseef (umr) (@comnets.uni-bremen.de) Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 2-1 Table of Contents 1

More information

Physics 403. Segev BenZvi. Monte Carlo Techniques. Department of Physics and Astronomy University of Rochester

Physics 403. Segev BenZvi. Monte Carlo Techniques. Department of Physics and Astronomy University of Rochester Physics 403 Monte Carlo Techniques Segev BenZvi Department of Physics and Astronomy University of Rochester Table of Contents 1 Simulation and Random Number Generation Simulation of Physical Systems Creating

More information

Physical Tests for Random Numbers. in Simulations. P.O. Box 9 (Siltavuorenpenger 20 C) FIN{00014 University of Helsinki. Finland

Physical Tests for Random Numbers. in Simulations. P.O. Box 9 (Siltavuorenpenger 20 C) FIN{00014 University of Helsinki. Finland Physical Tests for Random Numbers in Simulations I. Vattulainen, 1;2 T. Ala{Nissila, 1;2 and K. Kankaala 2;3 1 Research Institute for Theoretical Physics P.O. Box 9 (Siltavuorenpenger 20 C) FIN{00014 University

More information

Random numbers and random number generators

Random numbers and random number generators Random numbers and random number generators It was a very popular deterministic philosophy some 300 years ago that if we know initial conditions and solve Eqs. of motion then the future is predictable.

More information

14 Random Variables and Simulation

14 Random Variables and Simulation 14 Random Variables and Simulation In this lecture note we consider the relationship between random variables and simulation models. Random variables play two important roles in simulation models. We assume

More information

B. Maddah ENMG 622 Simulation 11/11/08

B. Maddah ENMG 622 Simulation 11/11/08 B. Maddah ENMG 622 Simulation 11/11/08 Random-Number Generators (Chapter 7, Law) Overview All stochastic simulations need to generate IID uniformly distributed on (0,1), U(0,1), random numbers. 1 f X (

More information

Physics 403 Monte Carlo Techniques

Physics 403 Monte Carlo Techniques Physics 403 Monte Carlo Techniques Segev BenZvi Department of Physics and Astronomy University of Rochester Table of Contents 1 Simulation and Random Number Generation Simulation of Physical Systems Creating

More information

Random Number Generators: Metrics and Tests for Uniformity and Randomness

Random Number Generators: Metrics and Tests for Uniformity and Randomness Random Number Generators: Metrics and Tests for Uniformity and Randomness E. A. Yfantis and J. B. Pedersen Image Processing, Computer Vision and Machine Intelligence Lab School of Computer Science College

More information

Sources of randomness

Sources of randomness Random Number Generator Chapter 7 In simulations, we generate random values for variables with a specified distribution Ex., model service times using the exponential distribution Generation of random

More information

Random Numbers. Pierre L Ecuyer

Random Numbers. Pierre L Ecuyer 1 Random Numbers Pierre L Ecuyer Université de Montréal, Montréal, Québec, Canada Random numbers generators (RNGs) are available from many computer software libraries. Their purpose is to produce sequences

More information

Recall the Basics of Hypothesis Testing

Recall the Basics of Hypothesis Testing Recall the Basics of Hypothesis Testing The level of significance α, (size of test) is defined as the probability of X falling in w (rejecting H 0 ) when H 0 is true: P(X w H 0 ) = α. H 0 TRUE H 1 TRUE

More information

Stochastic Simulation of

Stochastic Simulation of Stochastic Simulation of Communication Networks -WS 2014/2015 Part 2 Random Number Generation Prof. Dr. C. Görg www.comnets.uni-bremen.de VSIM 2-1 Table of Contents 1 General Introduction 2 Random Number

More information

Tutorial on Markov Chain Monte Carlo Simulations and Their Statistical Analysis (in Fortran)

Tutorial on Markov Chain Monte Carlo Simulations and Their Statistical Analysis (in Fortran) Tutorial on Markov Chain Monte Carlo Simulations and Their Statistical Analysis (in Fortran) Bernd Berg Singapore MCMC Meeting, March 2004 Overview 1. Lecture I/II: Statistics as Needed. 2. Lecture II:

More information

Generating pseudo- random numbers

Generating pseudo- random numbers Generating pseudo- random numbers What are pseudo-random numbers? Numbers exhibiting statistical randomness while being generated by a deterministic process. Easier to generate than true random numbers?

More information

More General Functions Is this technique limited to the monomials {1, x, x 2, x 3,...}?

More General Functions Is this technique limited to the monomials {1, x, x 2, x 3,...}? More General Functions Is this technique limited to the monomials {1, x, x 2, x 3,...}? Interpolation with General Sets of Functions For a general set of functions {ϕ 1,..., ϕ n }, solve the linear system

More information

Fast and Reliable Random Number Generators for Scientific Computing (extended abstract)

Fast and Reliable Random Number Generators for Scientific Computing (extended abstract) Fast and Reliable Random Number Generators for Scientific Computing (extended abstract) Richard P. Brent 1 Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK random@rpbrent.co.uk

More information

CSCE 564, Fall 2001 Notes 6 Page 1 13 Random Numbers The great metaphysical truth in the generation of random numbers is this: If you want a function

CSCE 564, Fall 2001 Notes 6 Page 1 13 Random Numbers The great metaphysical truth in the generation of random numbers is this: If you want a function CSCE 564, Fall 2001 Notes 6 Page 1 13 Random Numbers The great metaphysical truth in the generation of random numbers is this: If you want a function that is reasonably random in behavior, then take any

More information

Random number generators and random processes. Statistics and probability intro. Peg board example. Peg board example. Notes. Eugeniy E.

Random number generators and random processes. Statistics and probability intro. Peg board example. Peg board example. Notes. Eugeniy E. Random number generators and random processes Eugeniy E. Mikhailov The College of William & Mary Lecture 11 Eugeniy Mikhailov (W&M) Practical Computing Lecture 11 1 / 11 Statistics and probability intro

More information

2 Elementary algorithms for one-dimensional integrals

2 Elementary algorithms for one-dimensional integrals PY 502, Computational Physics, Fall 2017 Numerical Integration and Monte Carlo Integration Anders W. Sandvik, Department of Physics, Boston University 1 Introduction A common numerical task in computational

More information

Topics in Computer Mathematics

Topics in Computer Mathematics Random Number Generation (Uniform random numbers) Introduction We frequently need some way to generate numbers that are random (by some criteria), especially in computer science. Simulations of natural

More information

Some long-period random number generators using shifts and xors

Some long-period random number generators using shifts and xors ANZIAM J. 48 (CTAC2006) pp.c188 C202, 2007 C188 Some long-period random number generators using shifts and xors Richard P. Brent 1 (Received 6 July 2006; revised 2 July 2007) Abstract Marsaglia recently

More information

Department of Electrical- and Information Technology. ETS061 Lecture 3, Verification, Validation and Input

Department of Electrical- and Information Technology. ETS061 Lecture 3, Verification, Validation and Input ETS061 Lecture 3, Verification, Validation and Input Verification and Validation Real system Validation Model Verification Measurements Verification Break model down into smaller bits and test each bit

More information

Hands-on Generating Random

Hands-on Generating Random CVIP Laboratory Hands-on Generating Random Variables Shireen Elhabian Aly Farag October 2007 The heart of Monte Carlo simulation for statistical inference. Generate synthetic data to test our algorithms,

More information

Lecture 2 : CS6205 Advanced Modeling and Simulation

Lecture 2 : CS6205 Advanced Modeling and Simulation Lecture 2 : CS6205 Advanced Modeling and Simulation Lee Hwee Kuan 21 Aug. 2013 For the purpose of learning stochastic simulations for the first time. We shall only consider probabilities on finite discrete

More information

Statistics, Data Analysis, and Simulation SS 2013

Statistics, Data Analysis, and Simulation SS 2013 Mainz, May 2, 2013 Statistics, Data Analysis, and Simulation SS 2013 08.128.730 Statistik, Datenanalyse und Simulation Dr. Michael O. Distler 2. Random Numbers 2.1 Why random numbers:

More information

Independent Events. Two events are independent if knowing that one occurs does not change the probability of the other occurring

Independent Events. Two events are independent if knowing that one occurs does not change the probability of the other occurring Independent Events Two events are independent if knowing that one occurs does not change the probability of the other occurring Conditional probability is denoted P(A B), which is defined to be: P(A and

More information

Markov Chain Monte Carlo Simulations and Their Statistical Analysis An Overview

Markov Chain Monte Carlo Simulations and Their Statistical Analysis An Overview Markov Chain Monte Carlo Simulations and Their Statistical Analysis An Overview Bernd Berg FSU, August 30, 2005 Content 1. Statistics as needed 2. Markov Chain Monte Carlo (MC) 3. Statistical Analysis

More information

S.A. Teukolsky, Computers in Physics, Vol. 6, No. 5,

S.A. Teukolsky, Computers in Physics, Vol. 6, No. 5, Physics 75.502 Part III: Monte Carlo Methods 139 Part III: Monte Carlo Methods Topics: Introduction Random Number generators Special distributions General Techniques Multidimensional simulation References:

More information

Workshop on Heterogeneous Computing, 16-20, July No Monte Carlo is safe Monte Carlo - more so parallel Monte Carlo

Workshop on Heterogeneous Computing, 16-20, July No Monte Carlo is safe Monte Carlo - more so parallel Monte Carlo Workshop on Heterogeneous Computing, 16-20, July 2012 No Monte Carlo is safe Monte Carlo - more so parallel Monte Carlo K. P. N. Murthy School of Physics, University of Hyderabad July 19, 2012 K P N Murthy

More information

Fast Fraction-Integer Method for Computing Multiplicative Inverse

Fast Fraction-Integer Method for Computing Multiplicative Inverse Fast Fraction-Integer Method for Computing Multiplicative Inverse Hani M AL-Matari 1 and Sattar J Aboud 2 and Nidal F Shilbayeh 1 1 Middle East University for Graduate Studies, Faculty of IT, Jordan-Amman

More information

RANDOM NUMBER GENERATORS. Topic #3

RANDOM NUMBER GENERATORS. Topic #3 RANDOM NUMBER GENERATORS Topic #3 Randomness, random variables -> the notion of the probability - the chance of occurrence of an event - defined as a value between 0 and 1 - the sum of the probabilities

More information

Uniform Random Binary Floating Point Number Generation

Uniform Random Binary Floating Point Number Generation Uniform Random Binary Floating Point Number Generation Prof. Dr. Thomas Morgenstern, Phone: ++49.3943-659-337, Fax: ++49.3943-659-399, tmorgenstern@hs-harz.de, Hochschule Harz, Friedrichstr. 57-59, 38855

More information

Resolution-Stationary Random Number Generators

Resolution-Stationary Random Number Generators Resolution-Stationary Random Number Generators Francois Panneton Caisse Centrale Desjardins, 1 Complexe Desjardins, bureau 2822 Montral (Québec), H5B 1B3, Canada Pierre L Ecuyer Département d Informatique

More information

Pseudo-random Number Generation. Qiuliang Tang

Pseudo-random Number Generation. Qiuliang Tang Pseudo-random Number Generation Qiuliang Tang Random Numbers in Cryptography The keystream in the one-time pad The secret key in the DES encryption The prime numbers p, q in the RSA encryption The private

More information

Some long-period random number generators using shifts and xors

Some long-period random number generators using shifts and xors Some long-period random number generators using shifts and xors Richard. P. Brent 2 July 2007 Abstract Marsaglia recently introduced a class of xorshift random number generators (RNGs) with periods 2 n

More information

Computer Applications for Engineers ET 601

Computer Applications for Engineers ET 601 Computer Applications for Engineers ET 601 Asst. Prof. Dr. Prapun Suksompong prapun@siit.tu.ac.th Random Variables (Con t) 1 Office Hours: (BKD 3601-7) Wednesday 9:30-11:30 Wednesday 16:00-17:00 Thursday

More information

CDM. (Pseudo-) Randomness. Klaus Sutner Carnegie Mellon University Fall 2004

CDM. (Pseudo-) Randomness. Klaus Sutner Carnegie Mellon University  Fall 2004 CDM (Pseudo-) Randomness Klaus Sutner Carnegie Mellon University www.cs.cmu.edu/~sutner Fall 2004 CDM randomness 1 Battleplan Randomness in Physics Formalizing Randomness Practical RNGs CDM randomness

More information

Monte Carlo Simulations

Monte Carlo Simulations Monte Carlo Simulations What are Monte Carlo Simulations and why ones them? Pseudo Random Number generators Creating a realization of a general PDF The Bootstrap approach A real life example: LOFAR simulations

More information

Uniform and Exponential Random Floating Point Number Generation

Uniform and Exponential Random Floating Point Number Generation Uniform and Exponential Random Floating Point Number Generation Thomas Morgenstern Hochschule Harz, Friedrichstr. 57-59, D-38855 Wernigerode tmorgenstern@hs-harz.de Summary. Pseudo random number generators

More information

Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers

Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers Lecture 5: Random numbers and Monte Carlo (Numerical Recipes, Chapter 7) Motivations for generating random numbers To sample a function in a statistically controlled manner (i.e. for Monte Carlo integration)

More information

Uniform Random Number Generators for Supercomputers

Uniform Random Number Generators for Supercomputers Uniform Random Number Generators for Supercomputers Richard P. Brent 1 Computer Sciences Laboratory Australian National University Abstract We consider the requirements for uniform pseudo-random number

More information

IE 303 Discrete-Event Simulation L E C T U R E 6 : R A N D O M N U M B E R G E N E R A T I O N

IE 303 Discrete-Event Simulation L E C T U R E 6 : R A N D O M N U M B E R G E N E R A T I O N IE 303 Discrete-Event Simulation L E C T U R E 6 : R A N D O M N U M B E R G E N E R A T I O N Review of the Last Lecture Continuous Distributions Uniform distributions Exponential distributions and memoryless

More information

A fast random number generator for stochastic simulations

A fast random number generator for stochastic simulations A fast random number generator for stochastic simulations Anthony J. C. Ladd Department of Chemical Engineering, University of Florida, Gainesville, Florida 32611-6005, USA Abstract A discrete random number

More information

Generating Random Variables

Generating Random Variables Generating Random Variables These slides are created by Dr. Yih Huang of George Mason University. Students registered in Dr. Huang's courses at GMU can make a single machine-readable copy and print a single

More information

A TEST OF RANDOMNESS BASED ON THE DISTANCE BETWEEN CONSECUTIVE RANDOM NUMBER PAIRS. Matthew J. Duggan John H. Drew Lawrence M.

A TEST OF RANDOMNESS BASED ON THE DISTANCE BETWEEN CONSECUTIVE RANDOM NUMBER PAIRS. Matthew J. Duggan John H. Drew Lawrence M. Proceedings of the 2005 Winter Simulation Conference M. E. Kuhl, N. M. Steiger, F. B. Armstrong, and J. A. Joines, eds. A TEST OF RANDOMNESS BASED ON THE DISTANCE BETWEEN CONSECUTIVE RANDOM NUMBER PAIRS

More information

Random number generators

Random number generators s generators Comp Sci 1570 Introduction to Outline s 1 2 s generator s The of a sequence of s or symbols that cannot be reasonably predicted better than by a random chance, usually through a random- generator

More information

So far we discussed random number generators that need to have the maximum length period.

So far we discussed random number generators that need to have the maximum length period. So far we discussed random number generators that need to have the maximum length period. Even the increment series has the maximum length period yet it is by no means random How do we decide if a generator

More information

Some long-period random number generators using shifts and xors

Some long-period random number generators using shifts and xors Introduction Some long-period random number generators using shifts and xors Richard P. Brent MSI & RSISE, ANU Canberra, ACT 0200 CTAC06@rpbrent.com Marsaglia recently proposed a class of uniform random

More information

Radiation Transport Calculations by a Monte Carlo Method. Hideo Hirayama and Yoshihito Namito KEK, High Energy Accelerator Research Organization

Radiation Transport Calculations by a Monte Carlo Method. Hideo Hirayama and Yoshihito Namito KEK, High Energy Accelerator Research Organization Radiation Transport Calculations by a Monte Carlo Method Hideo Hirayama and Yoshihito Namito KEK, High Energy Accelerator Research Organization Monte Carlo Method A method used to solve a problem with

More information

Algorithms and Networking for Computer Games

Algorithms and Networking for Computer Games Algorithms and Networking for Computer Games Chapter 2: Random Numbers http://www.wiley.com/go/smed What are random numbers good for (according to D.E. Knuth) simulation sampling numerical analysis computer

More information

Fast and Reliable Random Number Generators for Scientific Computing

Fast and Reliable Random Number Generators for Scientific Computing Fast and Reliable Random Number Generators for Scientific Computing Richard P. Brent 1 Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QD, UK random@rpbrent.co.uk Abstract.

More information

1 Introduction. 2 Binary shift map

1 Introduction. 2 Binary shift map Introduction This notes are meant to provide a conceptual background for the numerical construction of random variables. They can be regarded as a mathematical complement to the article [] (please follow

More information

Finite Fields. SOLUTIONS Network Coding - Prof. Frank H.P. Fitzek

Finite Fields. SOLUTIONS Network Coding - Prof. Frank H.P. Fitzek Finite Fields In practice most finite field applications e.g. cryptography and error correcting codes utilizes a specific type of finite fields, namely the binary extension fields. The following exercises

More information

Institute for Theoretical Physics. Random Numbers for Large Scale Distributed Monte Carlo Simulations

Institute for Theoretical Physics. Random Numbers for Large Scale Distributed Monte Carlo Simulations Institute for Theoretical Physics Preprint Random Numbers for Large Scale Distributed Monte Carlo Simulations Heiko Bauke and Stephan Mertens Institut für Theoretische Physik, Universität Magdeburg, Universitätsplatz

More information

Stream Ciphers. Çetin Kaya Koç Winter / 20

Stream Ciphers. Çetin Kaya Koç   Winter / 20 Çetin Kaya Koç http://koclab.cs.ucsb.edu Winter 2016 1 / 20 Linear Congruential Generators A linear congruential generator produces a sequence of integers x i for i = 1,2,... starting with the given initial

More information

Lecture 20. Randomness and Monte Carlo. J. Chaudhry. Department of Mathematics and Statistics University of New Mexico

Lecture 20. Randomness and Monte Carlo. J. Chaudhry. Department of Mathematics and Statistics University of New Mexico Lecture 20 Randomness and Monte Carlo J. Chaudhry Department of Mathematics and Statistics University of New Mexico J. Chaudhry (UNM) CS 357 1 / 40 What we ll do: Random number generators Monte-Carlo integration

More information

A NEW RANDOM NUMBER GENERATOR USING FIBONACCI SERIES

A NEW RANDOM NUMBER GENERATOR USING FIBONACCI SERIES International J. of Math. Sci. & Engg. Appls. (IJMSEA) ISSN 0973-9424, Vol. 11 No. I (April, 2017), pp. 185-193 A NEW RANDOM NUMBER GENERATOR USING FIBONACCI SERIES KOTTA NAGALAKSHMI RACHANA 1 AND SOUBHIK

More information

Cryptographic Pseudo-random Numbers in Simulation

Cryptographic Pseudo-random Numbers in Simulation Cryptographic Pseudo-random Numbers in Simulation Nick Maclaren University of Cambridge Computer Laboratory Pembroke Street, Cambridge CB2 3QG. A fruitful source of confusion on the Internet is that both

More information

EEC 686/785 Modeling & Performance Evaluation of Computer Systems. Lecture 19

EEC 686/785 Modeling & Performance Evaluation of Computer Systems. Lecture 19 EEC 686/785 Modeling & Performance Evaluation of Computer Systems Lecture 19 Department of Electrical and Computer Engineering Cleveland State University wenbing@ieee.org (based on Dr. Raj Jain s lecture

More information

Chapter 4: Monte-Carlo Methods

Chapter 4: Monte-Carlo Methods Chapter 4: Monte-Carlo Methods A Monte-Carlo method is a technique for the numerical realization of a stochastic process by means of normally distributed random variables. In financial mathematics, it

More information

Math 676. A compactness theorem for the idele group. and by the product formula it lies in the kernel (A K )1 of the continuous idelic norm

Math 676. A compactness theorem for the idele group. and by the product formula it lies in the kernel (A K )1 of the continuous idelic norm Math 676. A compactness theorem for the idele group 1. Introduction Let K be a global field, so K is naturally a discrete subgroup of the idele group A K and by the product formula it lies in the kernel

More information

( x) ( ) F ( ) ( ) ( ) Prob( ) ( ) ( ) X x F x f s ds

( x) ( ) F ( ) ( ) ( ) Prob( ) ( ) ( ) X x F x f s ds Applied Numerical Analysis Pseudo Random Number Generator Lecturer: Emad Fatemizadeh What is random number: A sequence in which each term is unpredictable 29, 95, 11, 60, 22 Application: Monte Carlo Simulations

More information

Computer Applications for Engineers ET 601

Computer Applications for Engineers ET 601 Computer Applications for Engineers ET 601 Asst. Prof. Dr. Prapun Suksompong prapun@siit.tu.ac.th Random Variables (Con t) 1 Office Hours: (BKD 3601-7) Wednesday 9:30-11:30 Wednesday 16:00-17:00 Thursday

More information

MTH739U/P: Topics in Scientific Computing Autumn 2016 Week 6

MTH739U/P: Topics in Scientific Computing Autumn 2016 Week 6 MTH739U/P: Topics in Scientific Computing Autumn 16 Week 6 4.5 Generic algorithms for non-uniform variates We have seen that sampling from a uniform distribution in [, 1] is a relatively straightforward

More information

Monte Carlo integration (naive Monte Carlo)

Monte Carlo integration (naive Monte Carlo) Monte Carlo integration (naive Monte Carlo) Example: Calculate π by MC integration [xpi] 1/21 INTEGER n total # of points INTEGER i INTEGER nu # of points in a circle REAL x,y coordinates of a point in

More information

2008 Winton. Statistical Testing of RNGs

2008 Winton. Statistical Testing of RNGs 1 Statistical Testing of RNGs Criteria for Randomness For a sequence of numbers to be considered a sequence of randomly acquired numbers, it must have two basic statistical properties: Uniformly distributed

More information