-
-
Save pedrovhb/a35e6740db43891e249901f45d05060f to your computer and use it in GitHub Desktop.
Teste Python Random
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
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