c#: random int between two numbers

Trabla: c#: random int between two numbers

Solving:

Random rnd = new Random();

int v1 = rnd.Next(-100, 101); //Random ints from -100 to 101.

int v2 = rnd.Next(1,10); //Random ints from 1 to 10.

int v3 = rnd.Next(52); // Random ints from 0 to 52.

Official Docs: https://msdn.microsoft.com/en-us/library/2dx6wyd4(v=vs.110).aspx

No comments:

Post a Comment