topN using a heap

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 18 17:04:03 PST 2016


On 1/18/16 7:46 PM, Ilya wrote:
> On Tuesday, 19 January 2016 at 00:38:14 UTC, Timon Gehr wrote:
>> On 01/19/2016 01:12 AM, Ilya wrote:
>>>>
>>>
>>> There is already implementation with predictable seed. Proof:
>>> https://github.com/D-Programming-Language/phobos/blob/master/std/random.d#L1151
>>>
>>> --Ilya
>>
>> The default RNG is seeded with unpredictableSeed. What is the point
>> you are trying to make?
>
> unpredictableSeed is initialized only once and can be easily estimated.
> --Ilya

https://github.com/D-Programming-Language/phobos/blob/v2.069.2/std/random.d#L1120

unpredictableSeed uses MinstdRand0. The sources of randomness used for 
initializing MinstdRand0 are the PID, the thread ID, and the system time 
at the moment of the seeding. Then at each subsequent call to 
unpredictableSeed, the time of the call is XORed with the current value 
of the MinstdRand0.

How do you think things could be improved?


Andrei



More information about the Digitalmars-d mailing list