mardi 29 septembre 2020

Is there a shorter version, biased probability?

import random as rd
def prob(times):
    h,t=0,0
    for _ in range(times):
        if rd.randrange(1,11)<=7:h+=1
        else:t+=1
    return h

To return the results of biased coin flipping 70% head




Aucun commentaire:

Enregistrer un commentaire