Created
May 3, 2012 10:57
-
-
Save ashwin/2585006 to your computer and use it in GitHub Desktop.
Generate random float in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
# Random float in [0.0, 1.0) | |
a = random.random() | |
# Random float in [0, 100] | |
b = random.uniform( 0, 100 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I needed 0.01 -> 1.00 so used what you got and modified it a little. This is probably way overkill but wanted to share. =)