OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
6 * Tests for the toString methods on collections and maps. | 6 * Tests for the toString methods on collections and maps. |
7 */ | 7 */ |
8 | 8 |
9 #library('collection_to_string'); | 9 #library('collection_to_string'); |
10 #import('dart:math', prefix: 'Math'); | 10 #import('dart:math', prefix: 'Math'); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 return rand.nextInt(max); | 290 return rand.nextInt(max); |
291 } | 291 } |
292 | 292 |
293 /** Returns a random boolean value. */ | 293 /** Returns a random boolean value. */ |
294 bool randomBool() { | 294 bool randomBool() { |
295 return rand.nextBool(); | 295 return rand.nextBool(); |
296 } | 296 } |
297 | 297 |
298 /** Returns the alphabetized characters in a string. */ | 298 /** Returns the alphabetized characters in a string. */ |
299 String alphagram(String s) { | 299 String alphagram(String s) { |
300 List<int> chars = s.charCodes(); | 300 List<int> chars = s.charCodes; |
301 chars.sort((int a, int b) => a - b); | 301 chars.sort((int a, int b) => a - b); |
302 return new String.fromCharCodes(chars); | 302 return new String.fromCharCodes(chars); |
303 } | 303 } |
OLD | NEW |