Re: number generator
- From: Paul Rubin <http://phr.cx@xxxxxxxxxxxxxx>
- Date: 10 Mar 2007 16:47:11 -0800
"MonkeeSage" <MonkeeSage@xxxxxxxxx> 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])]
.
- Follow-Ups:
- Re: number generator
- From: Nick Craig-Wood
- Re: number generator
- From: MonkeeSage
- Re: number generator
- References:
- number generator
- From: cesco
- Re: number generator
- From: Steven D'Aprano
- Re: number generator
- From: greg
- Re: number generator
- From: MonkeeSage
- number generator
- Prev by Date: Re: PIL: reading bytes from Image
- Next by Date: Re: convert time string in UTC to time in local time
- Previous by thread: Re: number generator
- Next by thread: Re: number generator
- Index(es):
Relevant Pages
|
|