The example in this article describes how C # generates random numbers. Share to everyone for your reference. Specific as follows:
The code is as follows:
<summary>
Generate NUM digit Verification code for SMS verification function
</summary>
public static Random Rand = new Random ();
public static string getcode (int num)
{
string result = "";
string s = "uabcdefghijklmnopqrstuvwxyz0123456789";
for (int i = 0; i < num; i++)
{
int k = ((rand. Next (1, +) + i * 6)% 36) + 1;
result = String. Format ("{0}{1}", result, s[k]);
} return result;
}
Random r = new Random (); Create a random number generator
int v= R.next (1, 101); Get a random number that is less than or equal to 1 and less than 101. That is: Take a value between 1-100 (including 1, and 100)
In addition to the Declaration,
Running GuestArticles are original, reproduced please link to the form of the address of this article
C # Generate random number instances
This address: http://www.paobuke.com/develop/c-develop/pbk23171.html
Related content WPF button overload style workaround for TCP sticky packet problem in C # Learning notes-Basic Syntax C # simple implementation of a case for sending mail on a Web page
C # to read the entire file contents into a string variable C # implements fetching and analyzing Web page class instances on the problem of the C # algorithm on bull calves Three kinds of scenario analysis of C # thread synchronization
C # Generate random number instances