mercredi 26 avril 2017

Insert in a list random of 0 and 1 with a certain number of 1's

I want to generate a list of length N with random 0 and 1 values , but with a certain number of 1's put randomly in the list.

For example, I want a list of 10 elements(0 and 1) and the numbers of 1's in the list to be 7.

How can I do this?




Aucun commentaire:

Enregistrer un commentaire