Re: number generator



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
.



Relevant Pages

  • Re: What does "cruise" mean?
    ... An automatic 15 percent gratuity is added to all bar ... Passengers who want to adjust the amount of their ... They're very up-front about the standard amounts and the fact that ...
    (alt.usage.english)
  • Re: Manual Auto?
    ... this has a lot of 'tweaks' were you can adjust the amount to you own likings. ... So there is a lot of adjustment, and you do not need to know what the program actually does, you also do not have the control as you would have using photoshop with knowledge. ...
    (rec.photo.digital)
  • Re: Apex Barrel System???
    ... >they used a rubber nubing wich you could adjust the amount of ... >resistance thus increasing or decreasing the amount of backspin. ...
    (rec.sport.paintball)
  • Re: hue and saturation control
    ... Perhaps you messed up the rotation by using Cb' instead of Cb when ... then adjust the hue again by the same amount. ...
    (sci.image.processing)
  • Re: How do I clean up the system volume information?
    ... Then adjust the slider to the left ... to decrease the amount of disk space available to SR. ...
    (microsoft.public.windowsxp.help_and_support)