+ 3
How to ask computer to randomly choose a number between 1 to 6 in C#?
3 Answers
+ 3
Random rnd = new Random(); int month = rnd.Next(1, 13);
// creates a number between 1 and 12 int
dice = rnd.Next(1, 7);
// creates a number between 1 and 6 int
card = rnd.Next(52);
// creates a number between 0 and 51 int
card.rnd.Next(1,7);
// creates a number between 1 and 6 int
+ 2
Please mention C# in your Relevant Tags đ
(Edit)
Tags had been adjusted.
+ 1
like this #include <iostream> #include <cstdlib> #include <ctime> srand(time(0)); cout << rand()%6; for C++