[Tutor] Need help with random numbers
steve
lonetwin@yahoo.com
Tue, 17 Jul 2001 15:23:36 +0530
On Tuesday 17 July 2001 14:53, you wrote:
> 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?
>
> random()
> Return the next random floating point number in the range [0.0,
> 1.0).
>
> cheers,
>
> kevin parks
> seoul, korea
Although, I haven't had reason to use random yet (I'm still learning), I=
'd=20
assume a function
>>> def func(x, y): =20
=2E.. return random.random() + random.choice(range(x,y))
should return random enough float values between x and y
Peace
Steve
--=20
||||||||||||||||||||||
|||||||||#####||||||||
||||||||#######|||||||
||||||||# O O #|||||||
||||||||#\ ~ /#|||||||
||||||##||\_/||##|||||
|||||#||||||||||##||||
||||#||||||||||||##|||
||||#|||||||||||||##||=09
|||/\##|||||||||##/\||=09
|/ \#########/ \=09
|\ \#######/ /=09
||\____/#######\____/|=09
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=09
Debug is human, de-fix divine.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D