[SciPy-User] how to generate very small random number

Robert Kern robert.kern@gmail....
Wed Nov 16 04:58:59 CST 2011


On Wed, Nov 16, 2011 at 10:57, franck kalala
<franckkalala@googlemail.com> wrote:
> Hello Folk
>
> I would like to generate very small random number in scipy.
>
> the command  random()  generate random number in  (0,1).
>
> I am doing a simulation that involve very small numbers.
>
> for example I am doing somthing like this:
>
>>>> import random
>>>> a = random.random()
>>>> if a < 10**-6:
>           do something
>
> But the 'do domething' is never executed,  because   10**-6 is very small,
> and in many cases  the random number generate is large,
>
> I would like then to generate very small number of order  of  10**-6 for
> example,
>
> Any idea on how to do that?

np.random.uniform(0.0, 1e-5)

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the SciPy-User mailing list