Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _02._Randomize_Words__second_solution_
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] words = Console.ReadLine().Split(' ');
- Random rnd = new Random();
- for (int i = 0; i < words.Length; i++)
- {
- string currentWord = words[i];
- int randomIndex = rnd.Next(0, words.Length);
- words[i] = words[randomIndex];
- words[randomIndex] = currentWord;
- }
- Console.WriteLine(string.Join("\n", words));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement