boB Stepp <robertvst...@gmail.com> writes: > On Sat, Mar 19, 2016 at 8:03 AM, Steven D'Aprano <st...@pearwood.info> wrote: > > On Sat, Mar 19, 2016 at 04:05:58PM +1100, Ben Finney wrote: > >> if rng is None: > >> rng = random.random > > > > Typo: you want rng = random.randint.
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’. > >> result = rng.randint(1, num_sides) > > > > And here you just want result = rng(1, num_sides). Otherwise you're > > trying to call random.randint.randint. > > And then this statement would be correct as Ben wrote it. Unlike some other examples I have posted, I actually bothered to demonstrate this working as expected before posting it :-) > Ben, please chime in if I have got it wrong. You have it right, Bob. -- \ “If consumers even know there's a DRM, what it is, and how it | `\ works, we've already failed.” —Peter Lee, Disney corporation, | _o__) 2005 | Ben Finney _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor