Re: number generator
- From: greg <greg@xxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 10 Mar 2007 22:16:52 +1300
Steven D'Aprano wrote:
Last but not least, another possible algorithm is to start with a list of
N numbers, regardless of whether or not they add to M, and then adjust
each one up or down by some amount until they sum to the correct value.
Another possibility is to generate a list of N non-random
numbers that sum to M, and then adjust them up or down
by random amounts. By performing up/down adjustments in
pairs, you can maintain the sum invariant at each step.
So then it's just a matter of how long you want to go
on fiddling with them.
--
Greg
.
- Follow-Ups:
- Re: number generator
- From: MonkeeSage
- Re: number generator
- References:
- number generator
- From: cesco
- Re: number generator
- From: Steven D'Aprano
- number generator
- Prev by Date: Re: number generator
- Next by Date: Re: floating point rounding
- Previous by thread: Re: number generator
- Next by thread: Re: number generator
- Index(es):
Relevant Pages
|