PDA

View Full Version : random function in python



diffuser78
February 14th, 2006, 06:49 AM
I want to use random function but looks like this is not as trivial as in C or java.

I tried using whrandom class and randint method in it but Eric gave a message that its been deprecated.

I wat to assign a random value between say 0 and 100. I do the following. But get an error. What is the correct way of doing it.



x = int(math.random() * 100)


Thanks

WelterPelter
February 14th, 2006, 06:51 AM
random.randint(0,100)