On Sep 24, 10:38 am, Ian Kelly wrote:
> On Sat, Sep 24, 2011 at 12:55 AM, Steven D'Aprano
>
>
>
>
>
>
>
>
>
> wrote:
> > If you want unbiased, random (or at least pseudo-random) integers chosen
> > from an uniform distribution with proper error checking, you should use
> > randint or randrange.
>
On Sat, Sep 24, 2011 at 4:55 PM, Steven D'Aprano
wrote:
> Chris Angelico wrote:
>
> If you want unbiased, random (or at least pseudo-random) integers chosen
> from an uniform distribution with proper error checking, you should use
> randint or randrange.
>
> "I only need random-ish ints, but I nee
On Sat, Sep 24, 2011 at 12:55 AM, Steven D'Aprano
wrote:
> If you want unbiased, random (or at least pseudo-random) integers chosen
> from an uniform distribution with proper error checking, you should use
> randint or randrange.
>
>
>> but if you just
>> want a pile of more-or-less random integer
Chris Angelico wrote:
> On Fri, Sep 23, 2011 at 4:14 AM, Steven D'Aprano
> wrote:
>> What makes you think it's in C? I don't have Python 3.3a, but in 3.2 the
>> random module is mostly Python. There is an import of _random, which
>> presumably is in C, but it doesn't have a randint method:
>
> T
On Fri, Sep 23, 2011 at 4:14 AM, Steven D'Aprano
wrote:
> What makes you think it's in C? I don't have Python 3.3a, but in 3.2 the
> random module is mostly Python. There is an import of _random, which
> presumably is in C, but it doesn't have a randint method:
True. It seems to be defined in cpy
Chris Angelico wrote:
> The standard library function random.randint() seems to be quite slow
> compared to random.random(), and worse in Python 3 than Python 2
[...]
> But this still doesn't explain why randint() is so much slower. In
> theory, randint() should be doing basically the same thing t
The standard library function random.randint() seems to be quite slow
compared to random.random(), and worse in Python 3 than Python 2
(specifically that's 3.3a0 latest from Mercurial, and 2.6.6 that came
default on my Ubuntu install).
My test involves building a list of one million random integer