This is a multi-part message in MIME format.
--------------030306040309090306090209
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
The attached patch is a small change to the Array.shuffle algorithm to
prevent it from attempting to shuffle a 1-element array, and to avoid
the final unnecessary swap of the first array element with itself at the
end of the shuffle.
David
--------------030306040309090306090209
Content-Type: text/plain;
name atch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename atch"
Index: array.c
--- array.c (revision 13705)
+++ array.c (working copy)
@@ -2874,7 +2874,7 @@
rb_ary_modify(ary);
ary_iter_check(ary);
- while (i) {
+ while (i > 1) {
long j enrand_real()*i;
VALUE tmp ARRAY_PTR(ary)[--i];
RARRAY_PTR(ary)[i] ARRAY_PTR(ary)[j];
--------------030306040309090306090209--