Fixed Sort_Random not including first value in array sorting functions (bug 4292, r=psychonic).
This commit is contained in:
parent
1e5a375203
commit
764a04a201
@ -94,7 +94,7 @@ void sort_random(cell_t *array, cell_t size)
|
||||
|
||||
for (int i = size-1; i > 0; i--)
|
||||
{
|
||||
int n = (rand() % i) + 1;
|
||||
int n = rand() % (i + 1);
|
||||
|
||||
if (array[i] != array[n])
|
||||
{
|
||||
@ -435,7 +435,7 @@ void sort_adt_random(CellArray *cArray)
|
||||
|
||||
for (int i = arraysize-1; i > 0; i--)
|
||||
{
|
||||
int n = (rand() % i) + 1;
|
||||
int n = rand() % (i + 1);
|
||||
|
||||
cArray->swap(i, n);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user