[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-19 Thread Senhaji Rhazi hamza
Hey Steven, Thank you for having taken the time to comment qualitatively my response. For the first part : I think there is a way to map x <- [1; + inf] to y <- [0;1] by putting y = 1/x I didn't pay attention of the fact stated by @Richard Damon that the shape of distribution won't be

[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-19 Thread Stephen J. Turnbull
Senhaji Rhazi hamza writes: > I think there is a way to map x <- [1; + inf] to y <- [0;1] by > putting y = 1/x I don't think that's the point. I'll put money on a poor choice of value for the random parameter in the example: the OP chose the Pareto variate because that's what he mentioned

[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-18 Thread Andrew Barnert via Python-ideas
On Aug 18, 2019, at 06:20, Senhaji Rhazi hamza wrote: > > Hey Steven, > > I think there is a way to map x <- [1; + inf] to y <- [0;1] by putting y = 1/x Well, that gives you a distribution from (0, 1] instead of [0. 1), which is technically not legal as a substitute for random, even though

[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-18 Thread Richard Damon
> On Aug 18, 2019, at 9:20 AM, Senhaji Rhazi hamza > wrote: > > Hey Steven, > > I think there is a way to map x <- [1; + inf] to y <- [0;1] by putting y = 1/x > One big issue with using that mapping is it doesn’t preserve many of the characteristics of the initial distribution. If the x

[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-18 Thread Senhaji Rhazi hamza
Hey Steven, I think there is a way to map x <- [1; + inf] to y <- [0;1] by putting y = 1/x But i think there is another issue to consider : for example if we want to sort : random.choice(['a', 'b', 'c'], random=lambda: random.paretovariate(1.75)), we should have a mapping between the elements

[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-18 Thread Steven D'Aprano
On Sat, Aug 17, 2019 at 09:02:54AM +0200, Patryk Gałczyński wrote: > Hi! > > Recently I encountered a situation when I needed to pick a random > population sample but with specific distribution function - paretovariate in > this particular case. Let me see if I understand... you have a

[Python-ideas] Re: Fwd: Optional kwarg for sequence methods in random module

2019-08-17 Thread Andrew Barnert via Python-ideas
On Aug 17, 2019, at 00:02, Patryk Gałczyński wrote: > > One thing I'm concern about is how it would all relate to _randommodule.c (I > have little knowledge about C part) You probably don’t need to change the C code at all. I’m pretty sure none of these functions are implemented in C, they