February 27, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9607

           Summary: std.random.randomShuffle and partialShuffle don't work
                    with Xorshift
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2013-02-27 04:34:45 PST ---
import std.random: randomShuffle, rndGen, Mt19937,
                   Xorshift, partialShuffle;
void main() {
    int[] items = [10, 20, 30];
    randomShuffle(items); // OK
    randomShuffle(items, rndGen); // OK
    Mt19937 gen;
    randomShuffle(items, gen); // OK
    Xorshift rng;
    randomShuffle(items, rng); // Error.
    partialShuffle(items, 2, rng); // Error.
}



DMD 2.063alpha gives:


...\dmd2\src\phobos\std\random.d(1346): Error: constructor
std.random.XorshiftEngine!(uint, 128, 11, 8, 19).XorshiftEngine.this (uint x0)
is not callable using argument types (MersenneTwisterEngine!(uint, 32, 624,
397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18))
...\dmd2\src\phobos\std\random.d(1346): Error: cannot implicitly convert
expression (rndGen()) of type MersenneTwisterEngine!(uint, 32, 624, 397, 31,
2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18) to uint
...\dmd2\src\phobos\std\random.d(1376): Error: constructor
std.random.XorshiftEngine!(uint, 128, 11, 8, 19).XorshiftEngine.this (uint x0)
is not callable using argument types (MersenneTwisterEngine!(uint, 32, 624,
397, 31, 2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18))
...\dmd2\src\phobos\std\random.d(1376): Error: cannot implicitly convert
expression (rndGen()) of type MersenneTwisterEngine!(uint, 32, 624, 397, 31,
2567483615u, 11, 7, 2636928640u, 15, 4022730752u, 18) to uint
...\dmd2\src\phobos\std\random.d(1349): Error: template instance
std.random.partialShuffle!(int[], XorshiftEngine!(uint, 128, 11, 8, 19)) error
instantiating
temp3.d(10):        instantiated from here: randomShuffle!(int[],
XorshiftEngine!(uint, 128, 11, 8, 19))
temp3.d(10): Error: template instance std.random.randomShuffle!(int[],
XorshiftEngine!(uint, 128, 11, 8, 19)) error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 21, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9607


Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joseph.wakeling@webdrake.ne
                   |                            |t


--- Comment #1 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2013-06-21 07:10:47 PDT ---
It's an instance of Issue #2803.  I have a fix ready for this particular case -- will submit a pull request soon.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 22, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9607



--- Comment #2 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2013-06-22 02:03:34 PDT ---
(In reply to comment #1)
> It's an instance of Issue #2803.  I have a fix ready for this particular case -- will submit a pull request soon.

https://github.com/D-Programming-Language/phobos/pull/1362

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9607



--- Comment #3 from github-bugzilla@puremagic.com 2013-07-15 15:16:10 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/e86bc65639036d240d5ec6ce0254ccebee097943
Fix Issue 9607 - std.random.randomShuffle() and partialShuffle()
don't work with Xorshift.

This is an instance of Issue 2803, a clash between a template parameter and a default argument.  I've used the workaround proposed in that issue thread: http://d.puremagic.com/issues/show_bug.cgi?id=2803#c1

Tests have been included to ensure that these functions work with all possible RNG types.

https://github.com/D-Programming-Language/phobos/commit/443b54e30b4b67b8968ecde51dcae66c855c135b Merge pull request #1362 from WebDrake/randomshuffle

Fix Issue 9607 - std.random.randomShuffle() and partialShuffle() don't work
with Xorshift.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9607


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: -------
July 16, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9607



--- Comment #4 from Joseph Rushton Wakeling <joseph.wakeling@webdrake.net> 2013-07-16 02:32:31 PDT ---
*** Issue 7863 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home