Dear Forum, On Tue, July 29, 2014 1:34 pm, Frank Lübeck wrote: > On Thu, Jul 24, 2014 at 09:57:56AM -0400, J DIXON wrote: >> The original question was: how can you produce a different series of >> "random" elements each time? Surely in this case it is enough to >> have a procedure (perhaps using RealRandomSource) to produce a new >> seed and then run the standard generator from there? >> - John Dixon > > Dear Forum, > > Yes, this is the right suggestion. You just need a session dependent seed > to reset the global random number generator which is used by all > Random-functions in the GAP library. Here is how you can do this: > > If you have the IO-package installed put this before your code for which you > want a different random-behaviour in different GAP sessions: > > ##################################################################### > LoadPackage("io"); # better make sure IO is loaded at startup > Reset(GlobalMersenneTwister, > Random(RandomSource(IsRealRandomSource, "urandom"), 1, 2^512));; > #####################################################################
This depends on the purpose you need the random numbers for -- if it is for cryptographic purposes, this is NOT the right suggestion, as the Mersenne Twister is not a cryptographically secure pseudorandom number generator. -- Citing from Wikipedia (http://en.wikipedia.org/wiki/Mersenne_twister): > The algorithm in its native form is not suitable for cryptography > (i.e. it is not a CSPRNG). The reason is that observing a sufficient number > of iterations (624 in the case of MT19937, since this is the size of the > state vector from which future iterations are produced) allows one to > predict all future iterations. Best regards, Stefan ----------------------------------------------------------------------------- http://www.gap-system.org/DevelopersPages/StefanKohl/ ----------------------------------------------------------------------------- _______________________________________________ Forum mailing list Forum@mail.gap-system.org http://mail.gap-system.org/mailman/listinfo/forum