OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Dart test for List.shuffle. | 5 // Dart test for List.shuffle. |
6 library shuffle_test; | 6 library shuffle_test; |
7 | 7 |
8 import "dart:typed_data"; | 8 import "dart:typed_data"; |
9 import "dart:math" show Random; | 9 import "dart:math" show Random; |
10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 index = (index + 1) % _values.length; | 118 index = (index + 1) % _values.length; |
119 return next; | 119 return next; |
120 } | 120 } |
121 | 121 |
122 int nextInt(int limit) => _next % limit; | 122 int nextInt(int limit) => _next % limit; |
123 | 123 |
124 double nextDouble() => _next / 256.0; | 124 double nextDouble() => _next / 256.0; |
125 | 125 |
126 bool nextBool() => _next.isEven; | 126 bool nextBool() => _next.isEven; |
127 } | 127 } |
OLD | NEW |