www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8314] New: randomSample primes with constant

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: dawg dawgfoto.de



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: -------
Jun 27 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8314




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/aa896e08ccbdb3deee98658f09022bdb4c5dc503
set random generator in constructor

- Bug 8314 was already fixed by adding a _first flag

https://github.com/D-Programming-Language/phobos/commit/92335506d309d4f06e1757b149c5069d02ac1174


fix issue 8314

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 22 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8314


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |FIXED


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