Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: sdk/lib/_collection_dev/iterable.dart

Issue 25931003: Make List.shuffle take an optional Random object to use. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_collection_dev/iterable.dart
diff --git a/sdk/lib/_collection_dev/iterable.dart b/sdk/lib/_collection_dev/iterable.dart
index 5001fe38fe20cefba1d83a18e521d7404e5a38c4..3cc913baa37eae41ef30921970ba3b3805939ef4 100644
--- a/sdk/lib/_collection_dev/iterable.dart
+++ b/sdk/lib/_collection_dev/iterable.dart
@@ -958,8 +958,8 @@ class IterableMixinWorkaround {
Sort.sort(list, compare);
}
- static void shuffleList(List list) {
- Random random = new Random();
+ static void shuffleList(List list, Random random) {
+ if (random == null) random = new Random();
int length = list.length;
while (length > 1) {
int pos = random.nextInt(length);

Powered by Google App Engine
This is Rietveld 408576698