Generating a random number

Magnus Lie Hetland mlh at idi.ntnu.no
Sat Oct 6 10:02:50 EDT 2001


"Joshua Macy" <l0819m0v0smfm001 at sneakemail.com> wrote in message
news:3BBE4728.40101 at sneakemail.com...
>
>
> Dale Strickland-Clark wrote
>
> >
> > from whrandom import randint
> >
> > print randint(1, 10)
>
>
>
>
>    whrandom is deprecated.  Use random instead.

Actually, randint is deprecated as well... Use randrange
instead :)

Note that when using randrange, the endpoints are interpreted
as with the range function, so the statement becomes

  print randrange(1,11)

or
  print randrange(10)+1

>
>   Joshua

--

  Magnus Lie Hetland         http://www.hetland.org

 "Reality is that which, when you stop believing in
  it, doesn't go away."           -- Philip K. Dick






More information about the Python-list mailing list