[Python-ideas] A few suggestions for the random module

Raymond Hettinger raymond.hettinger at gmail.com
Fri Jun 24 00:02:20 CEST 2011


On Jun 23, 2011, at 7:53 PM, Sven Marnach wrote:

> I'd like to suggest what I consider a few minor improvements to
> Python's random module.

You can create a feature request on the bug tracker and assign to me.

> 
> 1. random.expovariate(lambd)

This seems reasonable
> 
> 2. random.sample(population, k)

This may be a unnecessary optimization (not worth the complexity),
but I will look at it further.

> 
> 3. random.choice(seq)

It could be generalized to arbitrary iterables (Bentley provides an example of how to do this) but it is fragile (i.e. falls apart badly with weak random number generators) and doesn't correspond well with real use cases.  


Raymond
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110624/d6686dd1/attachment.html>


More information about the Python-ideas mailing list