Drastically affects the statistical properties and

This preview shows page 4 - 9 out of 9 pages.

drastically affects the statistical properties and the cycle length. The random integers are being generated [ 0,m-1 ], and to convert the integers to random numbers: ,... 2 , 1 , 0 , mod ) ( 1 = + = + i m c aX X i i The multiplier The increment The modulus ,... 2 , 1 , = = i m X R i i
Image of page 4

Subscribe to view the full document.

5 Examples [LCM] Use X 0 = 27 , a = 17 , c = 43 , and m = 100 . The X i and R i values are: X 1 = (17*27+43) mod 100 = 502 mod 100 = 2, R 1 = 0.02; X 2 = (17*2+43) mod 100 = 77, R 2 = 0.77 ; X 3 = (17*77+43) mod 100 = 52, R 3 = 0.52; X 4 = (17* 52 +43) mod 100 = 27, R 3 = 0.27 “Numerical Recipes in C” advocates the generator a = 1664525, c = 1013904223, and m = 2 32 Classical LCG’s can be found on
Image of page 5
6 Characteristics of a Good Generator [LCM] Maximum Density Such that the values assumed by R i , i = 1,2,… , leave no large gaps on [0,1] Problem: Instead of continuous, each R i is discrete Solution: a very large integer for modulus m Approximation appears to be of little consequence Maximum Period To achieve maximum density and avoid cycling. Achieve by: proper choice of a , c , m , and X 0 . Most digital computers use a binary representation of numbers Speed and efficiency are aided by a modulus, m , to be (or close to) a power of 2 .
Image of page 6

Subscribe to view the full document.

7 A Good LCG Example X=2456356; %seed value for i=1:10000, X=mod(1664525*X+1013904223,2^32); U(i)=X/2^32; end edges=0:0.05:1; M=histc(U,edges); bar(M); hold; figure; hold; for i=1:5000, plot(U(2*i-1),U(2*i)); end
Image of page 7
8 Randu (from IBM, early 1960’s) X=1; %seed value for i=1:10000,
Image of page 8

Subscribe to view the full document.

Image of page 9
You've reached the end of this preview.
  • Spring '12
  • mehmet
  • Randomness, random numbers, Ri, Statistical randomness, statistical properties

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern