Skip to content
Sign upLog in
← Back to Community
Is it possible to generate a random-number in C# ?
Profile icon
BrightSideSide

Can anyone tell me how can I generate a random number in C#?
if it is possible

Answered by WWEMONSTERMONST [earned 5 cycles]
View Answer
Voters
Profile icon
BrightSideSide
Comments
hotnewtop
Profile icon
WWEMONSTERMONST

It's just easy you can just use the following code:

Random rnd = new Random(); int num1 = rnd.Next(1, 13); // creates a number between 1 and 12 int num2 = rnd.Next(1, 7); // creates a number between 1 and 6 int num3 = rnd.Next(52); // creates a number between 0 and 51
Profile icon
BrightSideSide