mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
[rng] Cleanup: remove unused function 'shuffle_ptr'
This commit is contained in:
parent
a023595b6f
commit
e08b4f3b01
20
src/rng.c
20
src/rng.c
@ -124,26 +124,6 @@ rng_rand_range(struct rng_ctx *ctx, int32_t min, int32_t max)
|
|||||||
return min + res;
|
return min + res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fisher-Yates shuffling algorithm
|
|
||||||
* Durstenfeld in-place shuffling variant
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
shuffle_ptr(struct rng_ctx *ctx, void **values, int len)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int32_t j;
|
|
||||||
void *tmp;
|
|
||||||
|
|
||||||
for (i = len - 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
j = rng_rand_range(ctx, 0, i + 1);
|
|
||||||
|
|
||||||
tmp = values[i];
|
|
||||||
values[i] = values[j];
|
|
||||||
values[j] = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fisher-Yates shuffling algorithm
|
/* Fisher-Yates shuffling algorithm
|
||||||
* Durstenfeld in-place shuffling variant
|
* Durstenfeld in-place shuffling variant
|
||||||
*/
|
*/
|
||||||
|
@ -18,9 +18,6 @@ rng_rand(struct rng_ctx *ctx);
|
|||||||
int32_t
|
int32_t
|
||||||
rng_rand_range(struct rng_ctx *ctx, int32_t min, int32_t max);
|
rng_rand_range(struct rng_ctx *ctx, int32_t min, int32_t max);
|
||||||
|
|
||||||
void
|
|
||||||
shuffle_ptr(struct rng_ctx *ctx, void **values, int len);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
shuffle_int(struct rng_ctx *ctx, int *values, int len);
|
shuffle_int(struct rng_ctx *ctx, int *values, int len);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user