Skip to content

Instantly share code, notes, and snippets.

@wbowling
Created February 21, 2018 00:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wbowling/e20b6cd096d480d623462632b4ba0329 to your computer and use it in GitHub Desktop.
Save wbowling/e20b6cd096d480d623462632b4ba0329 to your computer and use it in GitHub Desktop.
microsoft c runtime implementation of rand srand in python
#!/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