vendredi 24 mars 2017

How to randomly mix List content under the same indexes

I'm wondering, what is a proper way to mix List<string> list = new List<string>(); content inside the list randomly, without using of another list for random rewriting.

For example, if I got value by index this way:

list[0];
list[1];
list[2];
list[3];

and order output is:

line1
line2
line3
line4

after desired mixing, how is possible to get it under the same indexes, but over the randomly mixed values:

list[0];
list[1];
list[2];
list[3];

to get random order inside the list:

line2
line4
line1
line3




Aucun commentaire:

Enregistrer un commentaire