[Tutor] Need help with random numbers

Andrew Wilkins toodles@yifan.net
Tue, 17 Jul 2001 21:54:39 +0800


 > Since it has be brought up, I'd like to know:
>
> random.random() takes no args and returns a float in the range
> 0.0-1.0. How would you return random floats of a different range?
> say: 1.0 - 12.0?
>

*cuts and pastes from Wesley's post*

uniform(a, b):  does almost the same thing as randint(), but returns a
float and is inclusive only of the smaller number (exclusive of the larger
number), i.e. a <= N < b

Regards,

Andrew Wilkins