Mercurial > libdvdnav.hg
changeset 84:ba1121a07120 src
Properly seed the DVD VM Instruction rand().
author | jcdutton |
---|---|
date | Sat, 31 Aug 2002 11:05:27 +0000 |
parents | 5716523464dd |
children | aa14e5673881 |
files | dvdnav.c |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/dvdnav.c Sat Aug 31 10:51:01 2002 +0000 +++ b/dvdnav.c Sat Aug 31 11:05:27 2002 +0000 @@ -38,6 +38,7 @@ #include <stdlib.h> #include <stdio.h> +#include <sys/time.h> /* * NOTE: @@ -175,6 +176,7 @@ dvdnav_status_t dvdnav_open(dvdnav_t** dest, char *path) { dvdnav_t *this; + struct timeval time; /* Create a new structure */ fprintf(MSG_OUT, "libdvdnav: Using dvdnav version from http://dvd.sf.net\n"); @@ -216,7 +218,13 @@ /* Start the read-ahead cache. */ this->cache = dvdnav_read_cache_new(this); - + + /* Seed the random numbers. So that the DVD VM Command rand()i + * gives a different start value each time a DVD is played. + */ + gettimeofday(&time,NULL); + srand(time.tv_usec); + return S_OK; } @@ -990,6 +998,9 @@ /* * $Log$ + * Revision 1.33 2002/08/31 11:05:27 jcdutton + * Properly seed the DVD VM Instruction rand(). + * * Revision 1.32 2002/08/31 02:50:27 jcdutton * Improve some debug messages. * Add some comments about dvdnav_open memory leaks.