good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Generate all unique combinations of 1 and 0 using specified length of "0"-string and count of 1'sby tobyink (Canon) |
on Sep 18, 2020 at 10:40 UTC ( [id://11121912]=note: print w/replies, xml ) | Need Help?? |
For an especially slow solution, just read 10 bytes from /dev/random and test whether it contains seven 0s and three 1s. If it does, keep it. If it doesn't, discard it and repeat.
In Section
Seekers of Perl Wisdom
|
|