[Tutor] randomly gen values from .000001 to 10

David Broadwell dbroadwell at mindspring.com
Thu Mar 18 21:36:23 EST 2004


> import random
> foo = (random.random() * 10) + 0.000001
> 
> and get numbers from 0.000001 --> 10. 0.000001
> 
> which is actually good enough for gov't work. I don't care that I go 
> over, but I do care if I get less than 0.000001 which would make my 
> filter blow up.

?

if foo is not between 0.000001 and 10.:
	get_a_new_random_number()

--

Programmer's mantra; Observe, Brainstorm, Prototype, Repeat

David Broadwell



More information about the Tutor mailing list