www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2882] New: std.random.MersenneTwisterEngine without no seed

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2882

           Summary: std.random.MersenneTwisterEngine without no seed
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P4
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: repeatedly gmail.com


void main()
{
    writeln("Case1");
    {
        Mt19937 gen = Mt19937(0);
        writeln(gen.front);
        gen.popFront;
        writeln(gen.front);
    }
    writeln("---");
    {
        Mt19937 gen = Mt19937(0);
        advance(gen, 1);  // skip 1 element
        writeln(gen.front);
        gen.popFront;
        writeln(gen.front);
    }
    writeln("¥nCase2");
    {
        Mt19937 gen;
        writeln(gen.front);
        gen.popFront;
        writeln(gen.front);
    }
    writeln("---");
    {
        Mt19937 gen;
        advance(gen, 1);  // skip 1 element
        writeln(gen.front);
        gen.popFront;
        writeln(gen.front);
    }
}

Result:

Case1
2357136044 (1)
2546248239 (2)
---
2546248239 (2)
3071714933 (3)

Case2
581869302  (1)
3890346734 (2)
---
581869302  (1)?
3890346734 (2)?

The second part of Case2 skipped one element using advance(calling popFront),
but the result didn't skip.


-- 
Apr 22 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2882


andrei metalanguage.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed in svn, will be part of 2.030.


-- 
Apr 23 2009