numtools

perform numerical operations on vectors and matrices in unix pipes
git clone git://src.adamsgaard.dk/numtools # fast
git clone https://src.adamsgaard.dk/numtools.git # slow
Log | Files | Refs | README | LICENSE Back to index

commit bc0de099a997dd7945d335a8eebd947d50d61f42
parent 5eb7b1d9e6225ae95a465c415705fc40f51f7523
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu,  5 May 2022 13:26:53 +0200

randcounts.c: fix deterministic output on OpenBSD

Diffstat:
Mrandcounts.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/randcounts.c b/randcounts.c @@ -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();