trandcounts.c: fix deterministic output on OpenBSD - numtools - perform numerical operations on vectors and matrices in unix pipes
 (HTM) git clone git://src.adamsgaard.dk/numtools
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit bc0de099a997dd7945d335a8eebd947d50d61f42
 (DIR) parent 5eb7b1d9e6225ae95a465c415705fc40f51f7523
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Thu,  5 May 2022 13:26:53 +0200
       
       randcounts.c: fix deterministic output on OpenBSD
       
       Diffstat:
         M randcounts.c                        |       6 ++++++
       
       1 file changed, 6 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/randcounts.c b/randcounts.c
       t@@ -67,11 +67,17 @@ main(int argc, char *argv[])
                        errx(1, "weights do not sum to 1 (%g)", weightsum);
        
                if (s)
       +#ifdef __OpenBSD__
       +                srand48_deterministic(seed);
       +#else
                        srand48(seed);
       +#endif
       +#ifndef __OpenBSD__
                else {
                        gettimeofday(&t1, NULL);
                        srand48(t1.tv_sec * t1.tv_usec); /* Caveat: identical seed for each ms */
                }
       +#endif
        
                for (j = 0; j < n; j++) {
                        val = drand48();