poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Set the random seed when .jmd is called for the first time


From: John Darrington
Subject: [PATCH] Set the random seed when .jmd is called for the first time
Date: Fri, 21 Feb 2020 17:57:57 +0100

---
 ChangeLog     | 5 +++++
 src/pk-misc.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 173308bb..4c61b8e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-16  John Darrington <address@hidden>
+
+       * src/pk-misc (pk_cmd_jmd): Set the random seed the first
+       time this function is called.
+
 2020-02-16  John Darrington <address@hidden>
 
        * src/pk-ios.c (close_completion_function): rename to
diff --git a/src/pk-misc.c b/src/pk-misc.c
index ab14b8ce..cd0fc6c3 100644
--- a/src/pk-misc.c
+++ b/src/pk-misc.c
@@ -18,6 +18,7 @@
 
 #include <config.h>
 #include <assert.h>
+#include <time.h>
 
 #include "poke.h"
 #include "pk-cmd.h"
@@ -83,6 +84,7 @@ pk_cmd_jmd (int argc, struct pk_cmd_arg argv[], uint64_t 
uflags)
 
   if (num_strings == 0)
     {
+      srand (time (NULL));
       char **p = strings;
       while (*p++ != NULL)
         num_strings++;
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]