Skip to content
Snippets Groups Projects
Select Git revision
  • 5c5332573dee72b46a619c8080c2fdeeb9336adf
  • master default protected
2 results

tirage-random.py

Blame
  • Forked from Vuillemot Romain / INF-TC1
    Source project has a limited visibility.
    tirage-des.py 529 B
    from random import *
    
    effectifs=[0,0,0,0,0,0]
    # OU 
    # effectif=[0]*6
    for n in range(10000):
        dice=randint(1,6)
        effectifs[dice-1]+=1
    
    print(effectifs)
    
    #--> [1642, 1710, 1683, 1661, 1678, 1626]
    # Donner l'intervalle de confiance associé à ce résultat à 95%
    
    #Même chose avec 2 dés
    from random import *
    
    effectifs=[0]*11
    for n in range(10000):
        de1=randint(1,6)
        de2=randint(1,6)
        twodice=de1+de2
        effectifs[twodice-2]+=1
    
    print(effectifs)
    # --> [299, 540, 832, 1159, 1401, 1665, 1401, 1103, 787, 541, 272]