c# ramdom

C#
//The following code returns a random number. 
int num = random.Next();
//The following code returns a random number less than 1000.
int num = random.Next(1000);
Source

Also in C#: