What is the use case of RandomCover?

Ivan Kazmenko gassa at mail.ru
Tue Feb 19 01:04:11 PST 2013


> Surely, because randomShuffle is re-ordering the elements 
> in-place, whereas randomCover is not.

Sorry, but that does not answer my question.  If "in-place 
shuffle" versus "function return value" was the only intended 
difference, randomCover could as well look like this (simplified 
to int[] case for expressiveness):

-----
int[] randomCover(int[] r, ref/*or not*/ Random rnd)
{
	auto s = r.dup;
	randomShuffle(s, rnd);
	return s;
}
-----

However, there are ~70 lines in the implementation quite 
different from just calling randomShuffle, presumably for some 
purpose.  And my question is, what is that purpose?


More information about the Digitalmars-d-learn mailing list