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

Rémi Denis-Courmont remi at remlab.net
Fri Mar 5 21:59:33 CET 2010


Le vendredi 5 mars 2010 20:36:14 git version control, vous avez écrit :
> 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.

Please. Don't use rand(). Ever. Not thread-safe.

rand_r() is better. But even that's not really random unless properly seeded. 
Therefore the same playlist will always be randomized to the same order.

Usually, vlc_rand_bytes() is much better, although overkill.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
http://fi.linkedin.com/in/remidenis



More information about the vlc-devel mailing list