mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[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
1 changed files with 1 additions and 1 deletions
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…
Add table
Add a link
Reference in a new issue