[Issue 5441] std.random.rndGen always returns Random.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Apr 8 15:32:29 PDT 2012


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


Stewart Gordon <smjg at iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg at iname.com


--- Comment #1 from Stewart Gordon <smjg at iname.com> 2012-04-08 15:33:08 PDT ---
(In reply to comment #0)
> Created an attachment (id=867) [details]
> Patch for this suggestion
> 
> rndGen always returns Random(usually MT) object. This is often useful, but
> randomShuffle cant't take other random generators.

It can, as of DMD 2.058 at least.  Its signature is

void randomShuffle(Range, RandomGen = Random)(Range r,
        ref RandomGen gen = rndGen)

The two parameters are the range to shuffle and the RNG to use to perform the
shuffle.

> I think following signature is better.
> 
>     ref RandomGen rndGen(RandomGen = Random)()

What, exactly, would your rndGen function _do_ to the RandomGen object you pass
into it???

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