branch: master
commit 54256392719b291548aa936e9e185797f2523f04
Author: Ludovic Courtès <l...@gnu.org>
Date:   Thu Feb 8 14:05:17 2018 +0100

    examples: random: Make derivations a bit more random.
    
    * examples/random-jobs.scm (random-derivation): Tweak the computation of
    SEED.  Actually use the new random state.
---
 examples/random-jobs.scm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/examples/random-jobs.scm b/examples/random-jobs.scm
index 9918cd1..9d26892 100644
--- a/examples/random-jobs.scm
+++ b/examples/random-jobs.scm
@@ -33,10 +33,11 @@
   (let ((nonce (random 1e6)))
     (run-with-store store
       (gexp->derivation "random"
-                        #~(let ((seed (logxor (getpid)
-                                              (car (gettimeofday)))))
-                            (seed->random-state seed)
-                            (sleep (pk 'sleeping (random 10)))
+                        #~(let* ((seed  (logxor #$(cdr (gettimeofday))
+                                                (car (gettimeofday))
+                                                (cdr (gettimeofday))))
+                                 (state (seed->random-state seed)))
+                            (sleep (pk 'sleeping (random 10 state)))
                             #$nonce
                             (mkdir #$output))))))
 

Reply via email to