[Tutor] how to generate random numbers in Python

Pujo Aji ajikoe at gmail.com
Sat Jun 4 23:43:38 CEST 2005

Don't forget to call : import random

import random
print random.randint(2,8)
print random.random()

good luck


On 6/4/05, Xiaoxia Xu <xiaoxia at dix.mines.edu> wrote:
> Hello,
> I tried to use a Python library module random() to generate some
> noise to my data. But the interpreter gave me an error
> message saying NameError: name 'random' is not defined.
> I thought this error is because I don't have the pertinent
> library included. Could anyone tell me how can I get this
> to work?
> Many thanks,
> Ellen
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list