Commit d6547572 authored by Antoine Cellerier's avatar Antoine Cellerier

Fix randomisation algorithm. Thanks to jawbroken on IRC.

parent 14dffe40
...@@ -146,7 +146,7 @@ void playlist_ItemArraySort( unsigned i_items, playlist_item_t **pp_items, ...@@ -146,7 +146,7 @@ void playlist_ItemArraySort( unsigned i_items, playlist_item_t **pp_items,
for( i_position = i_items - 1; i_position > 0; i_position-- ) for( i_position = i_items - 1; i_position > 0; i_position-- )
{ {
i_new = rand() % i_position; i_new = rand() % (i_position+1);
p_temp = pp_items[i_position]; p_temp = pp_items[i_position];
pp_items[i_position] = pp_items[i_new]; pp_items[i_position] = pp_items[i_new];
pp_items[i_new] = p_temp; pp_items[i_new] = p_temp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment