Created
February 21, 2018 00:44
-
-
Save wbowling/e20b6cd096d480d623462632b4ba0329 to your computer and use it in GitHub Desktop.
microsoft c runtime implementation of rand srand in python
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
#!/usr/bin/env python | |
def srand(s): | |
global seed | |
seed = s | |
# microsoft c runtime implementation | |
def rand(): | |
global seed | |
seed = (seed * 214013 + 2531011) % 2**64 | |
return (seed >> 16)&0x7fff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment