The Trunk: Collections-ul.267.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-ul.267.mcz

commits-2
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.267.mcz

==================== Summary ====================

Name: Collections-ul.267
Author: ul
Time: 28 December 2009, 2:05:02 am
UUID: 6a8e39c1-9002-b64b-a51b-defcdb4b75cb
Ancestors: Collections-ar.266

- improved SequenceableCollection >> #shuffledBy:

=============== Diff against Collections-ar.266 ===============

Item was changed:
  ----- Method: SequenceableCollection>>shuffledBy: (in category 'copying') -----
  shuffledBy: aRandom
+ "Durstenfeld's version of the Fisher-Yates shuffle"
 
  | copy |
  copy := self copy.
+ copy size to: 2 by: -1 do: [ :i |
- copy size to: 1 by: -1 do: [ :i |
  copy swap: i with: (aRandom nextInt: i) ].
  ^copy!