Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Randomize_Words
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] text = Console.ReadLine().Split();
- int firstWord = 0;
- int secondWord = 0;
- Random randomText = new Random();
- for (int i = 0; i < text.Length; i++)
- {
- firstWord = randomText.Next(0, text.Length);
- secondWord = randomText.Next(0, text.Length);
- string changeText = text[firstWord];
- text[firstWord] = text[secondWord];
- text[secondWord] = changeText;
- }
- foreach (var word in text)
- {
- Console.WriteLine(word);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement