EDIT: Removed Link.
As mentioned furthur along in the thread, this method is actually pretty terrible in terms of efficiency and should not be used :p
Psuedocode:
While a 1 exists in the array, pick a random array cell between 0 and Array.Width.
Does the random cell contain a 1? If it does, add one to it and stop the loop.
Otherwise, repeat.
If you want to expand this to a 2d or 3d array, you'll use a similar method, but randomly pick XYZ coordinates instead. Not recommended because you will no longer be able to use IndexOf to confirm if the target value exists in the array, and can end up with an endless loop.