C # Shuffle algorithm, simple demo!
<summary>///Shuffle algorithm///</summary>private void Test () { int[] icards = new int[54]; for (int i = 0; i < icards.length; i++) { Icards[i] = i + 1; } Random rand = new Random (); int itarget = 0, icardtemp = 0; for (int i = 0; i < icards.length; i++) { itarget = rand. Next (0, icards.length); Icardtemp = Icards[i]; Icards[i] = Icards[itarget]; Icards[itarget] = icardtemp; } for (int i = 0; i < icards.length; i++) { Response.Write ("+" + (i + 1) + "cards are:" + icards[i] + "<br/>"); }}
The above is the paper to share the entire content of the shuffle algorithm, I hope you can like.
In addition to the Declaration,Running GuestArticles are original, reproduced please link to the form of the address of this article
C # implementation shuffling algorithm
This address: http://www.paobuke.com/develop/c-develop/pbk23099.html
Related content asp: Control permissions in the view C # Simple read, change file creation, modification, and access time the difference between property and attribute in C # How to convert a DataTable in C #
C # Implement a method similar to Sina Weibo long URL to short address C # Multithreading Learning (ii) How to manipulate a thread the generic delegate instance of C # Basics Tutorial C # Implementation of image grayscale technology
C # implementation shuffling algorithm