Skip to content

Instantly share code, notes, and snippets.

@pedrovhb
Last active April 12, 2018 21:23
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 pedrovhb/a35e6740db43891e249901f45d05060f to your computer and use it in GitHub Desktop.
Save pedrovhb/a35e6740db43891e249901f45d05060f to your computer and use it in GitHub Desktop.
Teste Python Random
import random
gerados = []
for i in range(int(10e6)):
gerados.append(random.randint(0, 10))
repeticoes = []
for i in range(10):
repeticoes.append(gerados.count(i))
print('Repetições:', repeticoes)
print('Desvio máximo: {:.2f}%'.format(100 - 100*min(repeticoes)/max(repeticoes)))
# Repetições: [908353, 908334, 910868, 909515, 910266, 909240, 908829, 908778, 909720, 907446]
# Diferença máxima: 0.38%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment