In this paper, we describe the method of random shuffle in C #. Share to everyone for your reference. The implementation method is as follows:
The code is as follows:
Random Shuffle #region
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=ints. ToList ();
int[] outs = new INT[20];
Random rand = new Random ();
for (int i = 0; i <; i++)
{
int x = rand. Next (list. Count);
Outs[i] = list[x];
List. RemoveAt (x);
}
Response.Write ("
foreach (int i in outs)
{
Response.Write (i.ToString () + "");
}
#endregion
I hope this article is helpful to everyone's C # programming.
In addition to the Declaration,
Running GuestArticles are original, reproduced please link to the form of the address of this article
C # Implementation of random Shuffle method
This address: http://www.paobuke.com/develop/c-develop/pbk23140.html
Related Content C # multi-thread thread class in detail Silverlight implementation of image local amplification effect of C # basics--Variable C # double buffering implementation method (to prevent splash screen)
The difference between dynamic and VAR and the dynamic use of C # Implementation of the taskbar notification window file operation method in C # about the action and Func in C #
C # Implementation of random Shuffle method