Advertisement
Dim_ov

PRNG

Dec 18th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. def make_gen(a, b, mod=1 << 16):
  2.     def gen(x):
  3.         res = long(x)
  4.         while(True):
  5.             res = (a * res + b) % mod
  6.             yield res
  7.     return gen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement