Created
June 22, 2018 16:21
-
-
Save bsolomon1124/570688923daefcc99c69e8d8a15ddabf to your computer and use it in GitHub Desktop.
`os.urandom()` maps to ints in [0, 255]
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
# Informal proof | |
from math import inf | |
mn, mx = inf, -1 * inf | |
for _ in range(100000): | |
b = os.urandom(10) | |
new_min = min(b) | |
new_max = max(b) | |
if new_min < mn: | |
mn = new_min | |
if new_max > mx: | |
mx = new_max | |
if __name__ == '__main__': | |
print(mn, mx) | |
# (0, 255) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment