mandybrigwell
Member
Apologies; I'm completely failing to understand the sorting bit here.
How do I sort this array randomly so the keys stay paired up?
How do I sort this array randomly so the keys stay paired up?
Code:
string [int][int] list;
list[0][0] = "Alice";
list[1][0] = "Bob";
list[2][0] = "Charlie";
print("Unsorted");
dump(list); // Prints the list as above
print("Sorted");
sort list by random(1000000);
dump(list); // Prints the list with, alas, re-ordered pairs.