SoFunction
Updated on 2025-03-07

Methods for random shuffling of C#

#region Random shuffle
int[] ints = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; 
List<int> list=(); 
int[] outs = new int[20]; 
Random rand = new Random(); 
for (int i = 0; i < 20; i++) 

    int x = (); 
    outs[i] = list[x]; 
    (x); 

("<hr/>"); 
foreach (int i in outs) 

    (() + " "); 

#endregion