swarm-support
[Top][All Lists]
Advanced

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

Saving and reading rng state from (ascii) file?


From: Jan Kreft
Subject: Saving and reading rng state from (ascii) file?
Date: Tue, 13 Jun 2000 10:20:13 +0100 (BST)

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.



reply via email to

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