number generator

Paul Rubin http
Sat Mar 10 19:47:11 EST 2007


"MonkeeSage" <MonkeeSage at gmail.com> writes:
> Taking your comment and running with it...this is pretty much
> cheating, and requires that M be evenly divisible by N, and only works
> well with smaller N values, and selections are limited to numbers in
> the 1 to (M/N)+(M/N) range...but hey; other than that it's perfect, heh.

This still doesn't make terribly much sense in terms of the distribution
you get.

The fencepost method still seems to be simplest:

    t = sorted(random.sample(xrange(1,50), 4))
    print [(j-i) for i,j in zip([0]+t, t+[50])]



More information about the Python-list mailing list