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?

4th Apr 2018, 9:32 AM
John Bechtel
John Bechtel - avatar
2 ответов
+ 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.
4th Apr 2018, 10:57 AM
John Wells
John Wells - avatar
+ 3
Second method, get a random number 1 to 6. Use switch statement to print that pattern output as there are 6 combinations.
4th Apr 2018, 11:01 AM
John Wells
John Wells - avatar