June 12, 2012
Am Tue, 12 Jun 2012 13:14:23 +0200
schrieb Johannes Pfau <nospam@example.com>:

> Am Tue, 12 Jun 2012 11:48:11 +0200
> schrieb Jens Mueller <jens.k.mueller@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.
June 12, 2012
Am Mon, 11 Jun 2012 13:09:26 -0500
schrieb Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org>:

> We should have the same in std.random. Could anyone please initiate a pull request?
> 
> Thanks,
> 
> Andrei

https://github.com/D-Programming-Language/phobos/pull/627
June 12, 2012
On 11/06/12 19:09, Andrei Alexandrescu wrote:
> We should have the same in std.random. Could anyone please initiate a pull request?

I'll see what I can do.  Is it OK to pretty much copy the Boost code, bar D-ifying it a bit?  The licence is identical, so this shouldn't be an issue AFAICS.
June 12, 2012
On 12/06/12 13:15, Joseph Rushton Wakeling wrote:
> I'll see what I can do. Is it OK to pretty much copy the Boost code, bar
> D-ifying it a bit? The licence is identical, so this shouldn't be an issue AFAICS.

... hit Reply before all the other overnight (for me) emails arrived.  D'oh. :-\

June 13, 2012
Regarding the mass production of random UUIDs, I believe that one would have to provide a seed that was at least 128 bits (or 16 ubyteS) wide in order to have uniform probability of generating any one random UUID from the entire set of 2^128 possible values. (If I read the following web page [http://randomlib.sourceforge.net/html/seeds.html] correctly, there would seem to be a strong probability of collisions when generating more than 2^16 such UUIDs if only a 32-bit seed were used.)

In the same vein, when shuffling playing cards I reckon one would need a 226-bit (or 29-ubyte) seed to cover the entire set of 52! (or approximately 8 x 10^67) possible permutations. It may be that using even more bits is advisable.

I wish I understood PRNGs. I don't, but I think the above is true.

Thanks to everyone!

-- 
Andy.
June 14, 2012
On Sunday, 10 June 2012 at 08:20:37 UTC, Andrew Talbot wrote:
> Andrew Talbot wrote:
>
>> which I presume gives it 232 starting points, whereas I believe there should also be an alternative option to seed it with an array of up to 624 uintS, so that potentially it can be started in any one of its 19,937 internal states.
>
> Of course I meant "...in any one of its 2^19,937 internal states".

 This does take me back a few years when I was making a PRNG that accepted an int for seeding (to be compatible with C's srand). My solution ended up being that if you didn't use the RNG before you seeded it again it would append to the seed internally; So 2 int's worth would be a 64bit seed.

 Anyways it's mostly a thought. I'm sure you'll get far better answers from everyone else.
1 2
Next ›   Last »