I can access the dictionary by it’s index doing:
myDictionary.Keys[0];
myDictionary.Keys[1];
I also can access a value of the dictionary by it’s key:
myDiccionary[myKey];
Here you can find answer about how to shuffle a list, but not a dictionary. I think a solution could be creating an array with the keys I want to store afterwards within a dictionary. Then shuffle that list. Finally build the dictionary as follows:
foreach (int shuffledKeys in shuffledKeysList) {
myDiccionary.Add(shuffledKey, GetValueFromMy(shuffledKey));
}
I guess that should give me a shuffled dictionary as hopefully the access order by index will depend on the order the tuples (key, value) have been added to the dictionary. Does it work like that? Any other better implementation?