RandomSample with specified random number generator
jerro
a at a.com
Fri Jun 15 04:48:42 PDT 2012
On Friday, 15 June 2012 at 06:00:43 UTC, Artur Skawina wrote:
> On 06/15/12 00:55, Joseph Rushton Wakeling wrote:
>> sample = randomSample(iota(0, 100), 5, rndGen);
>>
>> ... should probably be disallowed on grounds of safety.
>
> Considering the output of this program:
>
> import std.stdio;
> import std.random;
>
> void main() {
> foreach (i; 0..20)
> writeln(randomSample([0,1,2,4,5,6,7,8,9], 3,
> Random(unpredictableSeed)));
> }
>
> I'd say the use of std.random should be disallowed on grounds
> of safety...
>
> Does it work for someone else? (JIC it's only my old GDC
> installation that fails)
>
> artur
Joseph's pull request already contains a fix for this bug but
I'm guessing it won't be merged until other issues with
randomSample are resolved.
More information about the Digitalmars-d
mailing list