I have issue i want to generate 10000 random float no's in a given range, I cannot use random module because it will always go out of my range
x=random.randrange(30.000000,40.000000,10000)
i tried this
and i'm exepcting 10,000 random float no. b/w them
You could use random.uniform
like:
import random
x = [random.uniform(30.0, 40.0) for i in range(10000)]
Alternatively, you could use numpy
like:
import numpy as np
x = np.random.uniform(30.0, 40.0, 10000)
NB:
The second option would give you an ndarray
, which is normally fine, but if your program requires you to have a list instead, you can just do this instead:
import numpy as np
x = np.random.uniform(30.0, 40.0, 10000).tolist()