Is there a way to obtain the system random seed with GPC? And to initialize it using system's time?
Thank you
Silvio
Silvio a Beccara wrote:
Is there a way to obtain the system random seed with GPC?
GPC's default PRNG doesn't use a single value, but an array as its internal state. You can seed it with SeedRandom from a singlue integer. (If you want to seed it randomly and later re-seed it to produce the same sequence, you can first get a random number, store it in a variable and pass it to SeedRandom.)
And to initialize it using system's time?
Also with SeedRandom, but not recommended, because Randomize (which you don't have to call explicitly since it's done automatically the first time you call Random) does it already. Even more, if the system provides /dev/[u]random devices (as Linux does, and perhaps some other systems), it will take the seed from there which is less reproducible.
GPC also provides hooks to plug in another PRNG. E.g., the System unit (optionally) installs a BP compatible one, including a RandSeed variable. But that's not really recommended except for backward compatibility.
Frank