Advertisement
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 Канзас_сити_шафл
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] array;
- string St_V = Console.ReadLine();
- array = St_V.Split(new char[] { ' ' });
- int[] arrInt = new int[array.Length];
- for (int i = 0; i < arrInt.Length; i++)
- {
- arrInt[i] = Convert.ToInt32(array[i]);
- Console.Write(arrInt[i] + " ");
- }
- Console.WriteLine();
- int[] arrShuffle = Shuffle(arrInt);
- for (int i = 0; i < arrShuffle.Length; i++)
- {
- Console.Write(arrShuffle[i] + " ");
- }
- Console.WriteLine();
- }
- static int[] Shuffle(int[] arrInt)
- {
- int First;
- int Second;
- int Memory;
- Random rand = new Random();
- for (int i = 0; i < arrInt.Length; i++)
- {
- First = rand.Next(0, arrInt.Length);
- Second = rand.Next(0, arrInt.Length);
- Memory = arrInt[Second];
- arrInt[Second] = arrInt[First];
- arrInt[First] = Memory;
- Console.WriteLine(First);
- Console.WriteLine(Second);
- }
- return arrInt;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement