I'm currently using the following to obtain a random Boolean value in Python with a set probability (in this example, a 60% chance of getting a True value):
useDist = numpy.random.choice([True, False], 1, p=[0.6, 0.4])
Is there a more efficient or more elegant way of doing this, without using a third party library?
Aucun commentaire:
Enregistrer un commentaire