Index: sdk/lib/_collection_dev/iterable.dart |
diff --git a/sdk/lib/_collection_dev/iterable.dart b/sdk/lib/_collection_dev/iterable.dart |
index 9e7b9902c8a67bda7d2aeef1b37d2f844c08e50b..58f580f3c3761c47e0a27a8bbc1013c68a15414b 100644 |
--- a/sdk/lib/_collection_dev/iterable.dart |
+++ b/sdk/lib/_collection_dev/iterable.dart |
@@ -953,6 +953,18 @@ class IterableMixinWorkaround { |
Sort.sort(list, compare); |
} |
+ static void shuffleList(List list) { |
+ Random random = new Random(); |
+ int length = list.length; |
+ while (length > 1) { |
+ int pos = random.nextInt(length); |
+ length -= 1; |
+ var tmp = list[length]; |
+ list[length] = list[pos]; |
+ list[pos] = tmp; |
+ } |
+ } |
+ |
static int indexOfList(List list, var element, int start) { |
return Arrays.indexOf(list, element, start, list.length); |
} |