a random matrix of zeros and ones with exactly N ones



How can I generate a random matrix of a defined size with elements
zero or one with exactly M ones? For example a 4*5 matrix with 9 ones
and 11 zeros. I want it to be completely random such that the
generated matrix be able to span the space of all possible
permutations of zeros and ones (M ones)in the matrix.
.



Relevant Pages