lundi 12 avril 2021

How to span the range in random function Python?

I want to get a random number from 0 to 1e-20, I'm using the following function in Python

random.uniform(1e0, 1e-20)

However, the numbers are only from 1e0 missing the rest of the range such as 1e-12, 1e-9, etc.

How can I get a number among all the range?

Update:

0.8997498299014705
0.8320065922653802
0.9894039561126263
0.015205024292817781
0.8460417648041141
0.9744256248957714
0.10799180387896301
0.195940099219041
0.19830039605178706
0.694803475206833
0.5869371229317706
0.5762011063374192
0.2761909685255569
0.9757648088382384
0.0786057337977103
0.7090714156637489
0.6946835664286121
0.5975036696040513
0.7426259364954565
0.1116434886497456
0.6691228131282176



Aucun commentaire:

Enregistrer un commentaire