number generator

greg greg at cosc.canterbury.ac.nz
Sun Mar 11 03:16:01 EDT 2007


MonkeeSage wrote:
> this ... requires that M be evenly divisible by N,

No, it doesn't -- I never said the numbers had
to be *equal*.

> and only works well with smaller N values, 

Why?

> and selections are limited to numbers in the
 > 1 to (M/N)+(M/N) range

I don't understand what you mean by that. Note
that the adjustments don't have to be restricted
to *adjacent* numbers -- you can pick any pair
of numbers and transfer an amount from one to
the other, as long as neither of them goes
below 1, and you can perform as many adjustments
as you like. So *any* sequence of numbers that
sums to M is a possible output from some
algorithm of this kind.

As for the distribution, the OP said there were
"no other restrictions", so it seems that the
distribution doesn't matter. Actually, if you
take that at face value, the numbers don't
even have to be *random* at all... or,
equivalently, they can have a very skewed
distribution. :-)

--
Greg



More information about the Python-list mailing list