[Issue 10882] New: std.random.MersenneTwisterEngine.seed() fails if passed a static array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 24 09:26:11 PDT 2013


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

           Summary: std.random.MersenneTwisterEngine.seed() fails if
                    passed a static array
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: joseph.wakeling at webdrake.net


--- Comment #0 from Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> 2013-08-24 09:26:09 PDT ---
Created an attachment (id=1243)
Example code to illustrate the bug.  Comment out last line and the program runs
correctly.

MersenneTwisterEngine can take as seed either a single unsigned integer or a
range of 624 unsigned integers.  However, if a static array uint[624] is passed
to it, it fails with the following error:

----------------------------------------------
Error: template std.random.MersenneTwisterEngine!(uint, 32, 624, 397, 31,
2567483615u, 11, 7, 2636928640u, 15, 4022730752u,
18).MersenneTwisterEngine.seed does not match any function template
declaration. Candidates are:
/opt/dmd/include/d2/std/random.d(574):       
std.random.MersenneTwisterEngine!(uint, 32, 624, 397, 31, 2567483615u, 11, 7,
2636928640u, 15, 4022730752u, 18).MersenneTwisterEngine.seed()(UIntType value =
defaultSeed)
/opt/dmd/include/d2/std/random.d(613):       
std.random.MersenneTwisterEngine!(uint, 32, 624, 397, 31, 2567483615u, 11, 7,
2636928640u, 15, 4022730752u, 18).MersenneTwisterEngine.seed(T)(T range) if
(isInputRange!T && is(Unqual!(ElementType!T) == UIntType))
mtseed.d(10): Error: template std.random.MersenneTwisterEngine!(uint, 32, 624,
397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u,
18).MersenneTwisterEngine.seed()(UIntType value = defaultSeed) cannot deduce
template function from argument types !()(uint[624LU])
----------------------------------------------

The attached test code illustrates the problem, with Mt19937 accepting a
dynamic array of length 624 as seed, but not a static array of equal length.

-- 
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