Fixed Sort_Random not including first value in array sorting functions (bug 4292, r=psychonic).

This commit is contained in:
Peace-Maker 2013-01-23 12:51:19 -05:00
parent 1e5a375203
commit 764a04a201

View File

@ -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);
}