Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace C_Sharp_Junior
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random random = new Random();
- string userInput = "";
- int[] array = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
- while (userInput != "exit")
- {
- ShowConclusion(array);
- Shuffle(array, random);
- userInput = Console.ReadLine();
- }
- }
- static void Shuffle(int[] array, Random random)
- {
- for (int i = 0; i < array.Length; i++)
- {
- int randomElement = random.Next(i);
- int indexElement = array[i];
- array[i] = array[randomElement];
- array[randomElement] = indexElement;
- }
- }
- static void ShowConclusion(int[] arrayValue)
- {
- foreach (var ItemValue in arrayValue)
- {
- Console.Write(ItemValue + " ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement