Thursday, May 9, 2013

Random class

You can do it like:



Random r;
public Form1() //constructor of class
{
r = new Random();
int num1 = r.Next(1, 601); //1st option
int num2 = GetRandomNumber(); //2nd option
}

private int GetRandomNumber()
{
return r.Next(1, 601);
}





Mitja


No comments:

Post a Comment