On Sun, Mar 20, 2016 at 8:19 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote:
>
> Steven D'Aprano <st...@pearwood.info> writes:
>
> > On Mon, Mar 21, 2016 at 12:18:01AM +1100, Ben Finney wrote:
> > > No, I meant what I wrote. The ‘rng’ parameter is expected to be
> > > bound to a RNG. If the caller has not specified a custom RNG
> > > instance, we bind ‘rng’ to the standard RNG instance found at
> > > ‘random.random’.
>
> Steven is right, that name is a function not an RNG.
>
> The code should read::
>
>     if rng is None:
>         rng = random._inst
>
> which is the default RNG instance in the module.

Can I not use:

if rng is None:
    rng = random.Random()

?

When I tested it int the interpreter to see if I could use randint:

py3: rng = random.Random()
py3: rng.randint(1, 6)
4

Am I missing something basic here?

boB
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to