[SciPy-user] random number

Steve Schmerler elcorto at gmx.net
Tue Jun 29 09:07:25 CDT 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)
    >>> uniform(0,1e200)

But there is another downside here. 

    >>> x=[uniform(0,1e200) for i in range(1000)]

gives nearly 1000 rn's like

All rn's have an order of magnitude of 1e199, but I want also things like

    1e23, 1e45, 1e2, ....

Any idea how to do this??? (google should do it :) )

It seems as if 'uniform(min, max)' is implemented as


where 'random()' is a random float out of [0,1).  


"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