HTML version of Scripted Foils prepared 12 November 1996

Foil 5 Simple Random Number Generator

From CPS615-End of Basic Overview of Random Numbers and First Part of Monte Carlo Integration Delivered Lectures of CPS615 Basic Simulation Track for Computational Science -- 22 October 96. by Geoffrey C. Fox *
Secs 175.6
1 Take the choice:
2 m = 231
3 a = 1103515245
4 c = 12345
5 Implemented in C as (64 bit)
6 newran = [a*oldran+c] & MASK
7 floatran = newran/2147483648.0
8 oldran = newran
9 floatran is uniformly distributed in [0,1]
10 MASK has lower 31 bits = 1and all higher bits = 0
11 This intuitively says that lower order bits of a complex multiplication are "essentially" random

Table Font Size


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Fri Aug 15 1997