Reputation: 1099
I want to create a random float array of size 100, with the values in the array ranging from 0 to 1.
I have tried random.sample(range(1),100)
but that does not work.
How can i get what i want to achieve?
Upvotes: 0
Views: 256
Reputation: 114811
If you will be doing a lot of array computations, consider using the numpy library (http://www.numpy.org/). With numpy, you can use the function numpy.random.random
:
>>> a = numpy.random.random(100)
Upvotes: 1