import time class lcg (object): pass def compare_rngs(): # Seed the lcg so both instances start w/ the same value lcg.seed = time.time() # Instantiate two random number generators with parameters m, a, c gnu_c = lcg(2**32, 1103515245, 12345) randu = lcg(2**31, 65539, 0) # Print 5 values from each RNG for i in range(5): print gnu_c.rand() print for i in range(5): print randu.rand()