Skip to content

Instantly share code, notes, and snippets.

@blackrobot
Last active December 12, 2019 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackrobot/e8bda187045a6f49aee8778b8fcefc7e to your computer and use it in GitHub Desktop.
Save blackrobot/e8bda187045a6f49aee8778b8fcefc7e to your computer and use it in GitHub Desktop.
import time
import requests
MAX_UNICODE = 0x10ffff
def rand_bytes():
resp = requests.get("https://en.wikipedia.org/wiki/Special:Random")
content = resp.content
start = len(content) // 2
for x, y in zip(content[:start], content[start:]):
value = x * y * time.time()
yield chr(int(value % MAX_UNICODE))
if __name__ == "__main__":
import sys
for rand_byte in rand_bytes():
sys.stdout.buffer.write(rand_byte.encode("utf8"))
@blackrobot
Copy link
Author

$ python dev_pyrandom.py | head -c16

@blackrobot
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment