[vlc-commits] commit: Fix randomisation algorithm. Thanks to jawbroken on IRC. ( Antoine Cellerier )

git version control git at videolan.org
Fri Mar 5 19:36:14 CET 2010


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Fri Mar  5 11:34:42 2010 +0100| [d6547572772c97088bbd97a773d35565682b227c] | committer: Antoine Cellerier 

Fix randomisation algorithm. Thanks to jawbroken on IRC.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d6547572772c97088bbd97a773d35565682b227c
---

 src/playlist/sort.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/playlist/sort.c b/src/playlist/sort.c
index d6e5c3f..7c82606 100644
--- a/src/playlist/sort.c
+++ b/src/playlist/sort.c
@@ -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-- )
         {
-            i_new = rand() % i_position;
+            i_new = rand() % (i_position+1);
             p_temp = pp_items[i_position];
             pp_items[i_position] = pp_items[i_new];
             pp_items[i_new] = p_temp;



More information about the vlc-commits mailing list