jeudi 23 avril 2015

Generate random binary vector with equal Ones and Zeros

Say you want to create a random binary vector with 4 elements.

The constraint is that the numbers of one's and zero's have to be equal.

So

(0,0,1,1)
(0,1,1,0)
(1,1,0,0)
...

Is there an easy way to do this?




Aucun commentaire:

Enregistrer un commentaire