[Tutor] random numbers
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Tue Jul 6 19:18:48 CEST 2004
On Tue, 6 Jul 2004, Christopher Spears wrote:
> Is there a Python function somewhere that can generate a number
> randomly? Something that would give me an integer after inputing a
> range would be great.
Hi Christopher,
Ah, then the 'randrange()' function within the 'random' Standard Library
module should do the trick. The documentation on 'random' is here:
http://www.python.org/doc/lib/module-random.html
Try it out; if you have questions on it, please feel free to ask on the
list.
Good luck!
More information about the Tutor
mailing list