37.807614 to 37.786996
The randomly generated double must have the same precision (num of digits) as those above.
For example, 37.792242 would be good, whereas 37.7823423425 would be bad.
37.807614 to 37.786996
The randomly generated double must have the same precision (num of digits) as those above.
For example, 37.792242 would be good, whereas 37.7823423425 would be bad.
round(random.uniform(num1, num2), 6)
You will occasionally get numbers that end with ...0001
or ...9999
or so due to IEEE 754 inaccuracies though.
Not sure if I'm missing something, but to avoid rounding, and since you want exactly that precision, isn't it easiest to work in integers and then convert to floating point by division? I.e.
offset = float(random.randint(0,20618)) num = (offset + 37786996.0) / 1000000.0