C# Random

I. Introduction

In the Randomclass for creating random numbers. (Of course, it is pseudo-random.)

Two, Random usage

Example:

RND = new new the Random the Random (); 
int = month The rnd.Next (1, 13 is); // Create is a number between 1 to 12 
int dice = rnd.Next (1, 7 ); // Create a digital is between -. 6. 1 
int = rnd.Next Card (52 is); // Create is a number between 0 and 51

 

Next Random class provided, and nextBytes NextDouble ways to generate integer type, byte array type, and a random number of double precision floating point type, described in detail in the following table.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/qy1234/p/11824485.html