Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- Random rnd = new Random();
- int[] arr = new int[n];
- for (int counter = 1; counter < arr.Length; counter++)
- {
- arr[counter] = counter;
- }
- int temp, index;
- for (int i = 0; i < arr.Length; i++)
- {
- index = rnd.Next(arr.Length);
- temp = arr[i];
- arr[i] = arr[index];
- arr[index] = temp;
- }
- for (int i = 0; i < arr.Length; i++)
- {
- Console.Write(arr[i] + 1 + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement