[SciPy-user] random number
Steve Schmerler
elcorto at gmx.net
Tue Jun 29 10:07:25 EDT 2004
> You're right. Wasn't seed changing but truly out of bound call.
> Why do you need to generate uniform variate (0,1e38) ?
> Curious about applications !
>
> JC.
>
I'm testing an evolution strategy (similar to a genetic algorithm) for
parameter fitting. I need to construct parameter vectors
p = [p[1], ..., p[n]]
where each p[i] sould be a random number from 0 to 1e200.
I found that the module 'random' works with the 1e39-thing.
>>> from random import *
>>> uniform(0,1e39)
2.3437216521520377e+038
>>> uniform(0,1e200)
2.7167859425411156e+199
But there is another downside here.
>>> x=[uniform(0,1e200) for i in range(1000)]
gives nearly 1000 rn's like
2.3107981948610023e+199
All rn's have an order of magnitude of 1e199, but I want also things like
e.g.
1e23, 1e45, 1e2, ....
Any idea how to do this??? (google should do it :) )
It seems as if 'uniform(min, max)' is implemented as
random()*max
where 'random()' is a random float out of [0,1).
bye
--
"Documentation is like sex: when it's good,
it is very, very good; and when it's bad, it
is better than nothing." -- Dick Brandon
--
"Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
Jetzt aktivieren unter http://www.gmx.net/info
More information about the SciPy-User
mailing list