Last active
February 3, 2016 22:28
-
-
Save Tombert/46dddd2268b47a661a6d to your computer and use it in GitHub Desktop.
RandCat
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/python3 | |
import calendar | |
import time | |
seed = calendar.timegm(time.gmtime()) # We'll use the epoch time as a seed. | |
def random (seed): | |
seed2 = (seed*297642 + 83782)/70000 | |
return int(seed2) % 70000; | |
p = seed | |
while True: # if we're going with a mimicing of cat /dev/random, it'll pretty much just go until it's killed | |
p = random(p) | |
print(chr(p % 256), end="") | |
p = p % 4000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment