Created
September 26, 2014 16:10
-
-
Save whyrusleeping/550e4be5fd4741e1543c to your computer and use it in GitHub Desktop.
make some kinda random numbers in python
This file contains hidden or 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
primeA = 393342739 | |
primeB = 756065159 | |
class rander(object): | |
def __init__(self, seed): | |
self.seed = seed | |
def getByte(self): | |
self.seed = ((self.seed << 5) ^ primeA) % primeB | |
return int(self.seed % 256) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment