SHARE
TWEET

Untitled

Vadim_Rogulev Apr 19th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Канзас_сити_шафл
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string[] array;
  14.             string St_V = Console.ReadLine();
  15.             array = St_V.Split(new char[] { ' ' });
  16.             int[] arrInt = new int[array.Length];
  17.             for (int i = 0; i < arrInt.Length; i++)
  18.             {
  19.                 arrInt[i] = Convert.ToInt32(array[i]);
  20.                 Console.Write(arrInt[i] + " ");
  21.             }
  22.             Console.WriteLine();
  23.             int[] arrShuffle = Shuffle(arrInt);
  24.             for (int i = 0; i < arrShuffle.Length; i++)
  25.             {
  26.                 Console.Write(arrShuffle[i] + " ");
  27.             }
  28.             Console.WriteLine();
  29.         }
  30.         static int[] Shuffle(int[] arrInt)
  31.         {
  32.             int First;
  33.             int Second;
  34.             int Memory;
  35.             Random rand = new Random();
  36.             for (int i = 0; i < arrInt.Length; i++)
  37.             {
  38.                 First = rand.Next(0, arrInt.Length);
  39.                 Second = rand.Next(0, arrInt.Length);
  40.                 Memory = arrInt[Second];
  41.                 arrInt[Second] = arrInt[First];
  42.                 arrInt[First] = Memory;
  43.                 Console.WriteLine(First);
  44.                 Console.WriteLine(Second);
  45.             }
  46.             return arrInt;
  47.         }
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top