Update rprand.h
This commit is contained in:
parent
fe34fc7c6b
commit
01bbd42519
1 changed files with 4 additions and 5 deletions
9
src/external/rprand.h
vendored
9
src/external/rprand.h
vendored
|
@ -196,15 +196,14 @@ unsigned int *rprand_load_sequence(unsigned int count, int min, int max)
|
||||||
sequence = (unsigned int *)RPRAND_CALLOC(count, sizeof(unsigned int));
|
sequence = (unsigned int *)RPRAND_CALLOC(count, sizeof(unsigned int));
|
||||||
|
|
||||||
uint32_t value = 0;
|
uint32_t value = 0;
|
||||||
int value_count = 0;
|
|
||||||
bool value_is_dup = false;
|
bool value_is_dup = false;
|
||||||
|
|
||||||
for (int i = 0; value_count < count; i++)
|
for (int i = 0; i < count;)
|
||||||
{
|
{
|
||||||
value = rprand_xoshiro()%(max - min) + min;
|
value = rprand_xoshiro()%(max - min) + min;
|
||||||
value_is_dup = false;
|
value_is_dup = false;
|
||||||
|
|
||||||
for (int j = 0; j < value_count; j++)
|
for (int j = 0; j < i; j++)
|
||||||
{
|
{
|
||||||
if (sequence[j] == value)
|
if (sequence[j] == value)
|
||||||
{
|
{
|
||||||
|
@ -215,8 +214,8 @@ unsigned int *rprand_load_sequence(unsigned int count, int min, int max)
|
||||||
|
|
||||||
if (!value_is_dup)
|
if (!value_is_dup)
|
||||||
{
|
{
|
||||||
sequence[value_count] = value;
|
sequence[i] = value;
|
||||||
value_count++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue