Created
October 31, 2015 10:29
-
-
Save vfrico/82ae2e02d10553a6b67e to your computer and use it in GitHub Desktop.
Crear números aleatorios en 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 python3 | |
RANDBYTES = 280 #Número de Bytes aleatorios que tendrá de longitud | |
NUM = 1000 #Cantidad de números a sacar | |
import os | |
dist = open("randoms.txt",'w+') | |
for i in range(0,NUM): | |
ran = int.from_bytes(os.urandom(RANDBYTES), byteorder='little') | |
#dist.write(hex(ran) + "\n") #Imprime los números en hexadecimal | |
dist.write(str(ran) + "\n") #Imprime los números en decimal | |
dist.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment