jeudi 6 juillet 2017

Random Boolean array with 10 elements where 3 out of 10 are True [duplicate]

This question already has an answer here:

I have been searching all over the forum and google but I think I am using the wrong key words or I do not understand the solution. What I am looking for is to create a list or array with 10 random Boolean elements where I can decide that 1 or 2 or 3 or 4 etc. elements are True. The order must be random, in the end I want a result like this e.g. (a 0.3 chance):

False
True
False
False
True
False
False
False
True
False

Thnx.




Aucun commentaire:

Enregistrer un commentaire