def seedme(): c = 1000000000 b = open('tst.txt','w') while c < 2000000000: a, x = divmod(c, 30268) a, y = divmod(c, 30306) a, z = divmod(c, 30322) k = int(x)+1, int(y)+1, int(z)+1 b.write(str(random(k))) b.write(' ') c = c + 2 b.close() def random(seed): x, y, z = seed x = (171 * x) % 30269 y = (172 * y) % 30307 z = (170 * z) % 30323 seed = x, y, z # END CRITICAL SECTION # Note: on a platform using IEEE-754 double arithmetic, this can # never return 0.0 (asserted by Tim; proof too long for a comment). return int(((x/30269.0 + y/30307.0 + z/30323.0) * 10) % 10) seedme()