[Tutor] random floats in range func

Tim Peters tim.one at comcast.net
Thu May 6 12:05:23 EDT 2004


[kevin parks]
> One of the things i am constantly having to do, (and one of the odd
> things left out of the random module is to get a random FLOAT in a
> certain range, like say i want a random value from 4 to 9

For that much, you can use random.uniform(4, 9):

   http://docs.python.org/lib/module-random.html#l2h-1152



More information about the Tutor mailing list