in reply to random elements with fixed totals
"I know I can loop M times finding a random 0-element to switch to a 1 element"
A potential complexity you didn't realize (or maybe you realized but didn't mention) is that, loop M times, does not gurantee you M different positions, as the random number returned could be duplicates (Of course, you can adjust it, if it is duplicated, but that demages the level of randomization). BrowserUK's solution is preferred.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: random elements with fixed totals
by ysth (Canon) on Nov 16, 2003 at 06:53 UTC |