[Issue 8314] New: randomSample primes with constant

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 27 23:32:38 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8314

           Summary: randomSample primes with constant
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: dawg at dawgfoto.de


--- Comment #0 from dawg at dawgfoto.de 2012-06-27 23:35:08 PDT ---
import std.random, std.range, std.stdio;

void main()
{
    foreach (_; 0 .. 100)
    {
        immutable seed = unpredictableSeed();
        writeln(seed, " => ", randomSample(iota(100), 1, Random(seed)).front);
    }
}

--------

The random generator is assigned to the Range only after it was primed and
the default constructed random generator always returns the same first value.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list