Feed on

to sample from the uniform distribution between 0 and 1, you need to import the random module. then, simply call the random method:

>>> import random;
>>> rand_num = random.random()

Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

Did I get this wrong? Let me know!

Trackback URI | Comments RSS