Show seed for Mersenne RNG

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Show seed for Mersenne RNG

Kirill Orlov
Why would SPSS not allow me to know anyhow the currently set seed for Mersenne Twister random number generator?

For older, MC, generator, you may issue:

SET RNG=MC SEED=RANDOM.
SHOW SEED.

and get to know the seed value chosen by the system currently.

But you can't do it with MT generator. This

SET RNG=MT MTINDEX=RANDOM.
SHOW SEED.

won't help: it returns seed of MC, which is inactive.

And

SET RNG=MT MTINDEX=RANDOM.
SHOW MTINDEX.

is not allowed. No MTINDEX keyword exist in SHOW command.

I inderstand that MT "random" seed value chosen by the system can be fractional value of any precision. Still, why can't I know that value (to be able to use it subsequently if I want it)?

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Show seed for Mersenne RNG

Albert-Jan Roskam-3
Hi,

Weird indeed. I've noticed before that SHOW and SET are not perfectly symmetrical (e.g. 'environment').

In the source code of the MT algorithm (2002 version, which SPSS uses) I read:
        if (mti == N+1)   /* if init_genrand() has not been called, */
            init_genrand(5489UL); /* a default initial seed is used */

http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c

So perhaps the Mtindex equals 5489 when Set mtindex=random?


Date: Thu, 7 Apr 2016 12:28:03 +0300
From: [hidden email]
Subject: [SPSSX-L] Show seed for Mersenne RNG
To: [hidden email]

Why would SPSS not allow me to know anyhow the currently set seed for Mersenne Twister random number generator?

For older, MC, generator, you may issue:

SET RNG=MC SEED=RANDOM.
SHOW SEED.

and get to know the seed value chosen by the system currently.

But you can't do it with MT generator. This

SET RNG=MT MTINDEX=RANDOM.
SHOW SEED.

won't help: it returns seed of MC, which is inactive.

And

SET RNG=MT MTINDEX=RANDOM.
SHOW MTINDEX.

is not allowed. No MTINDEX keyword exist in SHOW command.

I inderstand that MT "random" seed value chosen by the system can be fractional value of any precision. Still, why can't I know that value (to be able to use it subsequently if I want it)?

===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@... (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Show seed for Mersenne RNG

Jon Peck
In reply to this post by Kirill Orlov
The reason is that the state of a Mersenne twister generator is not a simple number as it is for the older generator.  To show you the state, it would have to display a very large value - thousands of digits, which would not be very useful.  We thought about this a lot when designing this feature and concluded that the asymmetry where you can set the state simply but not display it was the only practical solution.

On Thu, Apr 7, 2016 at 3:28 AM, Kirill Orlov <[hidden email]> wrote:
Why would SPSS not allow me to know anyhow the currently set seed for Mersenne Twister random number generator?

For older, MC, generator, you may issue:

SET RNG=MC SEED=RANDOM.
SHOW SEED.

and get to know the seed value chosen by the system currently.

But you can't do it with MT generator. This

SET RNG=MT MTINDEX=RANDOM.
SHOW SEED.

won't help: it returns seed of MC, which is inactive.

And

SET RNG=MT MTINDEX=RANDOM.
SHOW MTINDEX.

is not allowed. No MTINDEX keyword exist in SHOW command.

I inderstand that MT "random" seed value chosen by the system can be fractional value of any precision. Still, why can't I know that value (to be able to use it subsequently if I want it)?

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD



--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD