Chronology | Current Month | Current Thread | Current Date |
[Year List] [Month List (current year)] | [Date Index] [Thread Index] | [Thread Prev] [Thread Next] | [Date Prev] [Date Next] |
should be:That's how this manual sees it....
import random
a_random_number=random.random()
if you're doing a lot of numerical work, then you would probably be using numpy a lot, so you could do:
import numpy
a_random_number=numpy.random.rand()
or, a little cleaner
from numpy.random import rand
a_random_number=rand()
the nice thing about numpy's rand is you can do many numbers at a time, into an array:
many_numbers=rand(10)
In [3]:many_numbers
Out[3]:
array([ 0.15296176, 0.38802752, 0.24167338, 0.29598626, 0.69464607,
0.59655328, 0.93598768, 0.95347925, 0.10564925, 0.60714371])
good luck!
bb