How to display the seed for Mersenne twister random number generator

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

How to display the seed for Mersenne twister random number generator

Frank Furter
This post was updated on .
Colleagues:

How can I display the seed of the Mersenne twister random number generator
when MTINDEX = Random? For the legacy MC random number generator, this can
be done by the SHOW SEED command. Is there anything comparable for the MT
generator?

Best regards, Andreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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: How to display the seed for Mersenne twister random number generator

Jon Peck
The Mersenne seed or generator state cannot be displayed, because it is a 64K random string and would be useless.  Instead you can just set a new seed at that point, which will enable you to return to that state.

On Wed, Mar 28, 2018 at 9:10 AM AndreasV <[hidden email]> wrote:
Colleagues:

How can I display the seed of the Mersenne twister random number generator
when MTINDEX = Random? For the legacy MC random number generator, this can
be done by the SHOW SEED command. Is there anything comparable for the MT
generator?

Best regards, ASndreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: How to display the seed for Mersenne twister random number generator

Kirill Orlov
In reply to this post by Frank Furter
Use old generator to check your analysis, debug your code etc.
Use Mersenne to do real life simulations. For that, you typically don't need to know the current seed if the seed was random.

28.03.2018 18:10, AndreasV пишет:
Colleagues:

How can I display the seed of the Mersenne twister random number generator
when MTINDEX = Random? For the legacy MC random number generator, this can
be done by the SHOW SEED command. Is there anything comparable for the MT
generator?

Best regards, ASndreas


===================== 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: How to display the seed for Mersenne twister random number generator

Frank Furter
This post was updated on .
In reply to this post by Jon Peck
Jon:

For my application, the is documentation (I need to document the seed that
was actually used) rather than reproducibility, and I have to make sure that
the seed is chosen at random. If the seed of the Mersenne generator cannot
be displayed, seems to me that I have the following two options: (a)
either to gegerate a random seed before the actual randomization process and
then set this as a fixed seed for the Mersenne generator, or (b) use the
'legacy' MC generator instead.

Any other ideas?

Best, Andreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (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: How to display the seed for Mersenne twister random number generator

Jon Peck
How about generating a starting seed by using the old generator with the random start and then changing to the Mersenne generator and giving it that as a starting seed.

On Thu, Mar 29, 2018 at 3:33 AM AndreasV <[hidden email]> wrote:
Jon:

For my application, the is documentation (I need to document the seed that
was actually used) rather than reproducibility, and I have to make sure that
the seed is chosen at random. If the seed of the Mersenne generator cannot
be displayed, seems tom met that I have the following two options: (a)
either to gegerate a random seed before the actoal randomization process and
then set this as a fixed seed for the Mersenne generator, or (b) use the
'legacy' MC generator instead.

Any other ideas?

Best, Andreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: How to display the seed for Mersenne twister random number generator

Frank Furter
... sounds good. Can I pass the seed generated with the old generator on to
the Mersenne generator automatically? Do I have to display the seed, extract
it from the output, and then somehow (?) generate a SET MTINDEX command, or
is there any more straightforward way?

Best, Andreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: How to display the seed for Mersenne twister random number generator

Jon Peck
Here's a bit of code to handle this.  It gets a random number from the mc rng, displays it, and then sets the mt generator active and initializes it to this random number

begin program.
# set the MT random number generator to a known but random seed and activate it

import spss, spssaux
spss.Submit("set rng mc seed=random")
seed =  spssaux.getShow("seed")
print "*** Setting MT seed to %s" % seed
spss.Submit("set rng=mt mtindex=%s" % seed)
end program.

On Thu, Mar 29, 2018 at 8:42 AM, AndreasV <[hidden email]> wrote:
... sounds good. Can I pass the seed generated with the old generator on to
the Mersenne generator automatically? Do I have to display the seed, extract
it from the output, and then somehow (?) generate a SET MTINDEX command, or
is there any more straightforward way?

Best, Andreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: How to display the seed for Mersenne twister random number generator

Frank Furter
... thank you so much - just what I need :) Guess I should take the time to
look into Python programming ...

Best, Andreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: How to display the seed for Mersenne twister random number generator

Jon Peck
Building "smart" syntax is one of the things that Python is very good for.  All the work here is really being done by the Statistics backend, including OMS, but Python is acting as the controller.

On Thu, Mar 29, 2018 at 11:29 AM, AndreasV <[hidden email]> wrote:
... thank you so much - just what I need :) Guess I should take the time to
look into Python programming ...

Best, Andreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: How to display the seed for Mersenne twister random number generator

Frank Furter
Could you perhaps recommend some introductory reading or tutorial for using
Python with SPSS?

Best, Andreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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: How to display the seed for Mersenne twister random number generator

Jon Peck
A good place to start is the Programming and Data Management book.  You can download it from the IBM SPSS Predictive Analytics website:


Also, see the Programmability articles here:

And, of course, use the forums

On Fri, Mar 30, 2018 at 1:27 AM, AndreasV <[hidden email]> wrote:
Could you perhaps recommend some introductory reading or tutorial for using
Python with SPSS?

Best, Andreas



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
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