mardi 24 novembre 2015

Randomly ordered long sequence

From a start and end where both data types are long's, I'd like to produce a randomly sorted list with them.

At the moment, I'm using a for loop to populate a list, then shuffle the list using an extension method. However, when the difference between start and end are large, the for loop causes out of memory exceptions.

Is there a more efficient, sleeker method for producing an randomly sequenced list of long's, where each number only appears once?




Aucun commentaire:

Enregistrer un commentaire