List<int> numbers = new List<int> { 1, 2, 3, 4, 5 }; Random random = new Random(); int n = numbers.Count; while (n > 1) { n--; int k = random.Next(n + 1); int value = numbers[k]; numbers[k] = numbers[n]; numbers[n] = value; } foreach (int number in numbers) { Console.WriteLine(number); }