Created
April 21, 2015 16:26
-
-
Save mrdrozdov/a6349c00a943806f6630 to your computer and use it in GitHub Desktop.
Python PRNG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
p = 104729 | |
g = 7 | |
def getI(): | |
i = random.randint(1, p) | |
yield (i + 1) % p | |
def generate(): | |
return int((g ** getI().next()) % p) | |
if __name__ == '__main__': | |
print generate() | |
print generate() | |
print generate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment