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