Explain yourself with reStructured Text, embedded code, graphs, charts, and LaTeX–style math.
Join Siafoo Now
or
Learn More
WichmannHill 1
In Brief  The WichmannHill algorithm is a three seed pseudorandom number generator. The algorithm generates numbers between 0.0 and 1.0 with a cycle of . According to [Bevington] the algorithm is free of correlations and is a good generator for most purposes.... more 
Implementation Difficulty 
1 function get_random(seed_1, seed_2, seed_3):
2
3 seed_1 = 171 * (seed_1 % 177)  2*(seed_1 / 177)
4
5 if seed_1 < 0: seed_1 += 30269
6
7 seed_2 = 172 * (seed_2 % 176)  35*(seed_2 / 176)
8
9 if seed_2 < 0: seed_2 += 30307
10
11 seed_3 = 170 * (seed_3 % 178)  63*(seed_3 / 178)
12
13 if seed_2 < 0: seed_2 += 30323
14
15 temp = seed_1 / 30269 + seed_2/30307 + seed_3/30323
16
17 return temp  int(temp)
The WichmannHill algorithm is a three seed pseudorandom number generator. The algorithm generates numbers between 0.0 and 1.0 with a cycle of . According to [Bevington] the algorithm is free of correlations and is a good generator for most purposes.
[Bevington] 
Philip Bevington, Data Reduction and Error Analysis for the Physical Sciences, McGrawHill Science/Engineering/Math

Implementations
A simple (unoptimized) implementation of the WichmannHill pseudorandom number generator. The prng requires three seeds.
Add a Comment