diff options
Diffstat (limited to '')
-rw-r--r-- | src/queue.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/queue.c b/src/queue.c index e7ecb3d3a..30ecafeaa 100644 --- a/src/queue.c +++ b/src/queue.c @@ -243,6 +243,17 @@ queue_finish(struct queue *queue) } void +queue_shuffle_order(struct queue *queue) +{ + assert(queue->random); + + for (unsigned i = 0; i < queue->length; i++) + queue_swap_order(queue, i, + g_rand_int_range(queue->rand, i, + queue->length)); +} + +void queue_shuffle_range(struct queue *queue, unsigned start, unsigned end) { assert(start <= end); |