using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static Random _random = new Random();
static string[] ShuffleArray(string[] arr) {
List<KeyValuePair<int, string>> list = new List<KeyValuePair<int, string>>();
foreach (string s in arr) {
list.Add(new KeyValuePair<int, string>(_random.Next(), s));
}
var sorted = from item in list
orderby item.Key
select item;
string[] shuffled = new string[arr.Length];
int i = 0;
foreach (KeyValuePair<int, string> pair in sorted) {
shuffled[i++] = pair.Value;
}
return shuffled;
}
static void Main(string[] args)
{
string[] arr = new string[]
{
"c#",
"c",
"c++",
"go",
"java",
"python",
"rust",
};
string[] shuffledArr = ShuffleArray(arr);
foreach (string s in shuffledArr) {
Console.WriteLine(s);
}
}
}
/*
run:
c++
rust
c#
python
c
go
java
*/