I am generating a matrix of zeros and ones in python as
poblacionCandidata = np.random.randint(0, 2, size=(4, 2))
However, I need for it to be only two ones at most in each row.
I have checked this question, but it is too complex for me.
Can anyone help me with this
The result should be something like
[[1 1 0 0]
[1 0 0 1]
[1 0 0 0]
[0 1 0 0]]
Best regards
Aucun commentaire:
Enregistrer un commentaire