Fixed-size arrays and randomShuffle()
Dmitry Olshansky
dmitry.olsh at gmail.com
Thu May 3 07:26:40 PDT 2012
On 03.05.2012 18:02, Ali Çehreli wrote:
>
> > A quick follow-up:
> > I've tried some various random number engines, but neither come even
> > close to the performance of whatever is used for Java's
> > "Collection.shuffle()" method. Perhaps someone can shed some light on
> this?
>
> I have no idea with that one.
>
It's all about RNG used behind the scenes. Default one is Mersane
Twister which (AFAIK) is not particularly fast. But has a period of
2^19937 elements.
You should probably use XorShift or MinstdRand generator and a version
of shuffle with 2nd parameter.
--
Dmitry Olshansky
More information about the Digitalmars-d-learn
mailing list