Andreas Raab uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.163.mcz==================== Summary ====================
Name: Collections-ul.163
Author: ul
Time: 9 October 2009, 2:36:21 am
UUID: 0b0ed95e-4b15-ae44-9f7f-639cc85b4256
Ancestors: Collections-nice.162
- faster shuffle
=============== Diff against Collections-nice.162 ===============
Item was changed:
----- Method: SequenceableCollection>>shuffledBy: (in category 'copying') -----
shuffledBy: aRandom
+
| copy |
+ copy := self copy.
+ copy size to: 1 by: -1 do: [ :i |
+ copy swap: i with: (aRandom nextInt: i) ].
+ ^copy!
- copy := self shallowCopy.
- copy size to: 1 by: -1 do:
- [:i | copy swap: i with: ((1 to: i) atRandom: aRandom)].
- ^ copy!