RandomSample with specified random number generator

Artur Skawina art.08.09 at gmail.com
Sun Jun 17 11:50:29 PDT 2012


On 06/17/12 18:51, Joseph Rushton Wakeling wrote:
> I'm feeling a bit braindead today so I may have misunderstood your code, but I'm not sure your fix actually does fix the problem identified.  You could check out Jerro's pull request for an alternative:
> https://github.com/D-Programming-Language/phobos/pull/542

The result should be the same; I just wanted a fix and did that
one-liner, so that it would be clear the bugs aren't related.

>> Now the result is:
>>
>>     [0, 7568, 7476, 0, 7494, 7500, 7461, 7504, 7527, 7470]
>>
>> ie still not quite what you'd expect...
> 
> If you've got time, you might like to pull from my master branch:
> https://github.com/WebDrake/phobos
> 
> ... and check if the same bug arises.  I made exactly this kind of test.

I took your random.d and ran with that:

   [6612, 6650, 6704, 0, 6629, 6834, 6634, 6756, 6590, 6591]
   [6589, 6587, 6636, 0, 6673, 6704, 6647, 6704, 6643, 6817]
   [6744, 6552, 6602, 0, 6641, 6722, 6598, 6676, 6749, 6716]
   [6641, 6583, 6710, 0, 6618, 6684, 6789, 6673, 6683, 6619]
   [6667, 6692, 6600, 0, 6717, 6588, 6660, 6678, 6673, 6725]

so the problem is still there, just a little different.

I'm using an old GDC build, in case that makes any difference:

gcc version 4.6.3 20120106 (prerelease gdc 0.31 - r748:ab99d67f04c2, using dmd 2.057)

artur


More information about the Digitalmars-d mailing list