Mersenne Twister Seeding and UUIDs
Johannes Pfau
nospam at example.com
Tue Jun 12 04:20:52 PDT 2012
Am Tue, 12 Jun 2012 13:14:23 +0200
schrieb Johannes Pfau <nospam at example.com>:
> Am Tue, 12 Jun 2012 11:48:11 +0200
> schrieb Jens Mueller <jens.k.mueller at gmx.de>:
>
> > > * As seed is a normal function right now, I can't overload it
> > > with a template. Is it safe to make the original seed a template
> > > as well, so seedRange could be named seed, or would that break
> > > the API?
> >
> > What do you mean by you can't overload it? Does it not compile? I
> > think it should.
> >
> > > * How should the seed array/range be generated? By repeatedly
> > > calling unpredictableSeed?
> >
> > No idea what is recommended from cryptographic point of view.
> >
> > > * Is there a Range which repeatedly calls a function? Similar to
> > > repeat, but not repeating a value.
> >
> > Here is one way to do it.
> > seedRange(map!((a) => unpredictableSeed)(iota(0, 624)));
> > Probably, there is a more straightforward way.
>
> Thanks, that's good enough. It would be even better if it was an
> infinite range, though.
gen.seed(map!((a) => unpredictableSeed)(repeat(0)));
seems to work.
More information about the Digitalmars-d
mailing list