[Bug #21106] Remove the useless last iteration
When only one element remains, this simply swaps the first identical element and has no actual effect.
This commit is contained in:
parent
ace39a3ed4
commit
8dd0d63550
Notes:
git
2025-02-02 16:19:09 +00:00
2
array.c
2
array.c
@ -6701,7 +6701,7 @@ rb_ary_shuffle_bang(rb_execution_context_t *ec, VALUE ary, VALUE randgen)
|
||||
rb_ary_modify(ary);
|
||||
i = len = RARRAY_LEN(ary);
|
||||
RARRAY_PTR_USE(ary, ptr, {
|
||||
while (i) {
|
||||
while (i > 1) {
|
||||
long j = RAND_UPTO(i);
|
||||
VALUE tmp;
|
||||
if (len != RARRAY_LEN(ary) || ptr != RARRAY_CONST_PTR(ary)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user