[Numpy-discussion] Random int64 and float64 numbers

Robert Kern robert.kern@gmail....
Sun Nov 1 21:13:51 CST 2009


On Sun, Nov 1, 2009 at 20:57, Thomas Robitaille
<thomas.robitaille@gmail.com> wrote:
> Hi,
>
> I'm trying to generate random 64-bit integer values for integers and
> floats using Numpy, within the entire range of valid values for that
> type.

64-bit and larger integers could be done, but it requires
modification. The integer distributions were written to support C
longs, not anything larger. You could also use .bytes() and
np.fromstring().

> To generate random 32-bit floats, I can use:
> np.random.uniform(low=np.finfo(np.float32).min,high=np.finfo
> (np.float32).max,size=10)

What is the use case here? I know of none. Floating point is a bit
weird and will cause you many problems over such an extended range.

-- 
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 NumPy-Discussion mailing list