mirror of
https://github.com/tat3r/tdfiglet.git
synced 2024-11-21 15:46:40 +00:00
better random seed
This commit is contained in:
parent
e642b5ed76
commit
0225b8881d
@ -24,12 +24,12 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
#include <time.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -153,6 +153,8 @@ main(int argc, char *argv[])
|
|||||||
opt.random = false;
|
opt.random = false;
|
||||||
char *fontfile = NULL;
|
char *fontfile = NULL;
|
||||||
|
|
||||||
|
struct timeval tv;
|
||||||
|
|
||||||
DIR *d;
|
DIR *d;
|
||||||
struct dirent *dir;
|
struct dirent *dir;
|
||||||
SLIST_HEAD(, dirname_s) head = SLIST_HEAD_INITIALIZER(dirname_s);
|
SLIST_HEAD(, dirname_s) head = SLIST_HEAD_INITIALIZER(dirname_s);
|
||||||
@ -251,7 +253,9 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
closedir(d);
|
closedir(d);
|
||||||
|
|
||||||
srand(time(NULL));
|
gettimeofday(&tv, NULL);
|
||||||
|
|
||||||
|
srand(tv.tv_usec);
|
||||||
r = dll ? rand() % dll : 0;
|
r = dll ? rand() % dll : 0;
|
||||||
|
|
||||||
dp = SLIST_FIRST(&head);
|
dp = SLIST_FIRST(&head);
|
||||||
|
Loading…
Reference in New Issue
Block a user