chiark / gitweb /
I'm sick of `--generate' giving the same answers if you run it twice
authorSimon Tatham <anakin@pobox.com>
Mon, 23 May 2005 11:15:39 +0000 (11:15 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 23 May 2005 11:15:39 +0000 (11:15 +0000)
in one second. Switched the Unix get_random_seed() to using
gettimeofday() rather than time().

[originally from svn r5837]

gtk.c

diff --git a/gtk.c b/gtk.c
index 859231f9bce9d2d33c9827161ae2ed2b26af9f5a..ab10a11bc6e0a951a886407d8ee4b621c8b8bc6a 100644 (file)
--- a/gtk.c
+++ b/gtk.c
@@ -82,10 +82,10 @@ struct frontend {
 
 void get_random_seed(void **randseed, int *randseedsize)
 {
-    time_t *tp = snew(time_t);
-    time(tp);
-    *randseed = (void *)tp;
-    *randseedsize = sizeof(time_t);
+    struct timeval *tvp = snew(struct timeval);
+    gettimeofday(tvp, NULL);
+    *randseed = (void *)tvp;
+    *randseedsize = sizeof(struct timeval);
 }
 
 void frontend_default_colour(frontend *fe, float *output)