[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mersenne Twister range in rand.oct and randn.oct

From: Paul Kienzle
Subject: Re: Mersenne Twister range in rand.oct and randn.oct
Date: Sat, 3 Dec 2005 19:44:21 -0500

On Dec 1, 2005, at 9:58 AM, Mike Miller wrote:

On Thu, 1 Dec 2005, Mike Miller wrote:

In one Mersenne Twister FAQ I see this:

2002-version mt19937ar.c has versions [0,1],[0,1),[0,1),(0,1) (32-bit
  precision), and [0,1) with 53-bit precision.

Which am I getting when I use rand.oct in Octave forge? What I would really like to know are the largest and smallest values that can be produced both by rand.oct and by randn.oct.

I should say that it's really one .oct file:  rand.oct.
randn is derived from rand.oct.

I took a look at Octave Forge's but I can't find in it what I need to know (because of my incompetence, obviously).

The answer is in Makefile rather than This sets the ALL_BITS flag for building randmtzig.c. Here's the relevant code:

/* generates a random number on (0,1) with 53-bit resolution */
USE_INLINE double randu53(void)
    const uint32_t a=randi32()>>5;
    const uint32_t b=randi32()>>6;
    return(a*67108864.0+b+0.4) * (1.0/9007199254740992.0);

- Paul

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]