|
From: | Sven N. Thommesen |
Subject: | Re: Saving and reading rng state from (ascii) file? |
Date: | Tue, 13 Jun 2000 14:05:08 -0500 |
Jan,the documentation for this used to be in the "Random Appendix" to the reference guide, but the powers that be have now transferred some of what I wrote to the "Beta Users Guide" which you can find at the Swarm.Org web site. Check out section C.2.1.3. I have appended to this message the code in the random test suite that exercises the save-state/set-state machinery. If this doesn't run correctly at your site, I'll be happy to send you the whole test suite so we can figure things out.
I notice that your code differs from mine in that you have "unsigned *rngState" while I have and id, and my pointer is a (void *) rather than (unsigned *). Don't know if that's the source of your problem.
Perhaps Marcus has a point that I ought to add code to save and retrieve the random objects using lisp and/or hdf5, but from my own perspective it is a *feature*, not a bug, that the internals of the state are kept hidden ;-)
Marcus: perhaps a pointer from the (shortened) reference guide to the material now in the User Guide would be useful?
Cheers, Sven Thommesen At 10:20 AM 6/13/2000 +0100, you wrote:
Dear all, I'm trying to regularly save the state of the default MT19937 rng into a file, to be able to restart a run where it broke off due to power cut etc. Now I got thus far: unsigned rngStateSize; unsigned *rngState; rngStateSize = [randSource getStateSize]; // gives 5020 rngState = (unsigned *) [globalZone alloc: [randSource getStateSize]]; [randSource putStateInto: rngState]; // how to save the state? // how to read that in again? [randSource setStateFrom: rngState]; [globalZone free: rngState]; (randSource is a pointer to the MT19937 generator) Has someone got an example of how to do this? I couldn't find anything in the archive? Thanks, Jan. Jan Kreft Phone +44 (0)29 20875278 Cardiff School of Biosciences Fax +44 (0)29 20874305 Cardiff University E-mail address@hidden PO Box 915, Cardiff CF10 3TL, UK ================================== Swarm-Support is for discussion of the technical details of the day to day usage of Swarm. For list administration needs (esp. [un]subscribing), please send a message to <address@hidden> with "help" in the body of the message.
generatortest.m
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |