mercredi 14 décembre 2016

Generate conditioned random binary array matrix in python

what could be the most efficient way to generate a mxn binary array matrix which is contrained to the sum per column is equal 0 or 1 ?

somethin like this

[[0,0,1,0,0],
[1,1,0,0,0],
[0,0,0,0,1]
[0,0,0,0,0]]

m and n are going to be fixed, but n is larger than 500000 so iteration methods could take a long time until an appropied matrix is found.




Aucun commentaire:

Enregistrer un commentaire