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