randrange(start, stop)
only takes integer arguments. So how would I get a random number between two float values?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
random.uniform(a, b)
appears to be what your looking for. From the docs:See here.
if you want generate a random float with N digits to the right of point, you can make this :
the second argument is the number of decimals.
Use random.uniform(a, b):