Advertisement
Nikolay_Kashev

Randomize Words

May 27th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02._Randomize_Words
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string[] words = Console.ReadLine().Split(' ');
  10.             Random rnd = new Random();
  11.             for (int pos1 = 0; pos1 < words.Length; pos1++)
  12.             {
  13.                 int pos2 = rnd.Next(words.Length);
  14.                 pos1 = pos2;
  15.             }
  16.             Console.WriteLine(string.Join(Environment.NewLine, words));
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement