Fixed-size arrays and randomShuffle()
Chris Cain
clcain at uncg.edu
Thu May 3 08:53:32 PDT 2012
On a related note, how did you get the other random generators
working? I tried to compile this and it gives me an error:
-=-=-=-
import std.random, std.stdio, std.datetime;
void main() {
int[] arr = new int[5_000_000];
foreach(i, ref e; arr)
e = i;
auto rng = MinstdRand0(1);
rng.seed(unpredictableSeed);
StopWatch sw = AutoStart.yes;
randomShuffle(arr, rng);
sw.stop();
writeln("Took ", sw.peek().to!("msecs", double)(), "ms");
}
-=-=-=-
The error:
-=-=-=-
C:\D\dmd2\windows\bin\..\..\src\phobos\std\random.d(1263): Error:
cannot implicitly convert expression (rndGen()) of type
MersenneTwisterEngine!(uint,32,624,397,31,-1727483681u,11,7,-1658038656u,15,-272236544u,18)
to LinearCongruentialEngine!(uint,16807,0,2147483647)
-=-=-=-
Is this a bug in 2.059? Or am I doing something wrong?
More information about the Digitalmars-d-learn
mailing list