What is the use case of RandomCover?

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Feb 18 06:55:07 PST 2013


On 02/18/2013 03:35 PM, Ivan Kazmenko wrote:
> I wonder what is the use case of std.random.randomCover when one has
> std.random.randomShuffle.  I was trying to use it just to get a random
> permutation of integers, and found randomCover prior to randomShuffle.  However,
> for the number of elements as low as 10,000, the delay was already rather
> surprising, so I searched for a faster solution and found randomShuffle does a
> superior job.  And now I wonder: how does one correctly use randomCover? Below
> is a sample test program showing the difference.

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


More information about the Digitalmars-d-learn mailing list