Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp20
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] Array = { 1, 2, 3, 4, 5 };
- Shuffle(Array);
- for (int i = 0; i < Array.Length; i++)
- {
- Console.WriteLine(Array[i]);
- }
- }
- static int[] Shuffle(int[] Array)
- {
- Random rnd = new Random();
- int[]newArray = Array.OrderBy(s => rnd.Next()).ToArray();
- for (int i = 0; i < Array.Length; i++)
- {
- Array[i] = newArray[i];
- }
- Array = newArray;
- return Array;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment