[GAP Forum] Question about Random Elements

Attila Egri-Nagy A.Egri-Nagy at herts.ac.uk
Sat Apr 25 22:20:43 BST 2009


Hi,

I usually do this:

#getting the seed from the number of seconds from the Epoch
SecondsSinceTheUNIXEpoch := function()
local path, date,str,a;
  path := DirectoriesSystemPrograms();;
  date := Filename( path, "date" );
  str := "";
  a := OutputTextString(str,true);
  Process( DirectoryCurrent(), date, InputTextNone(), a, ["+%s"] );
  CloseStream(a);
  NormalizeWhitespace(str);
  return Int(str);
end;

rnd := RandomSource(IsGAPRandomSource,SecondsSinceTheUNIXEpoch());


this may be quite ugly code, but it works on UNIX machines.
However, MersenneTwister is 'immune' to setting the seed this way, I
don't know why..

best,
@

On Sat, Apr 25, 2009 at 6:57 PM, Joe Bohanon <jbohanon2 at gmail.com> wrote:
> I have a problem I'm working on that involves trying to find an element
> conjugating two subgroups of large matrix groups.  As I will likely have to
> run through lots of elements (even after some reductions to smaller
> subgroups).  I want to take advantage of a cluster with multiple processors,
> but the way I understand it, if I start gap off fresh and run Random or
> PseudoRandom, I will get the same sequence of elements.
>
> I'd like to be able to change the seed based on which instance of the
> program I am running.  All of the nodes have a shared hard drive, so I can
> get an incrementor easily.  I just don't know how to set the randomizer to
> start with a different seed.
>
> Thanks
> Joe
>
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
>



More information about the Forum mailing list