MATLAB: How to distribute 100 ones in 100 by 100 matrix randomly in all posibilities

binaryMATLABmatrix array

I want to make binary matrix, and distribute 100 ones in it, randomly in all possibilities.
What command I have to use plz help.

Best Answer

indices = randi(1e4,100,1);
x = zeros(100,100);
x(indices) = 1;