0
Can you Randomizing values not numerical in c#?
int num1, num2, num3; Console.Write("Input the first Number: "); num1 = int.Parse(Console.ReadLine()); Console.Write("Input the second Number: "); num2 = int.Parse(Console.ReadLine()); Console.Write("Input the third Number: "); num3 = int.Parse(Console.ReadLine()); Console.WriteLine("After swapping: "); Console.WriteLine("First number : " rndm); Console.WriteLine("Second number : " rndm); Console.WriteLine("Third number : " rndm); //How do you randomize this for the swapping so the answers are random?
2 Answers
+ 3
Get a random 1 to 3 to output that number first. Get a second random 1 to 2. Of the remaining numbers, output either the first or second.
+ 3
Second method, get a random number 1 to 6. Use switch statement to print that pattern output as there are 6 combinations.