I'm facing a problem with my code. The values has been randomly duplicated, and I'm not sure how to prevent from random duplication.
Here's my code:
public static Dictionary<TKey, TValue> Shuffle<TKey, TValue>(
this Dictionary<TKey, TValue> source)
{
Random r = new Random();
return source.OrderBy(x => r.Next())
.ToDictionary(item => item.Key, item => item.Value);
}