From fcfa49ef6735be96386bda87bab2d0976475f585 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sat, 27 Mar 2021 19:16:06 +0000 Subject: Promote Development to Advanced, Release 10.94.00 git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@4076 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/util/randsysrandom.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/util/randsysrandom.c (limited to 'lib/util/randsysrandom.c') diff --git a/lib/util/randsysrandom.c b/lib/util/randsysrandom.c new file mode 100644 index 00000000..3e38b0ae --- /dev/null +++ b/lib/util/randsysrandom.c @@ -0,0 +1,40 @@ +#define _DEFAULT_SOURCE /* New name for SVID & BSD source defines */ +#define _XOPEN_SOURCE 500 /* Make sure random() is in stdlib.h */ +#define _BSD_SOURCE /* Make sure random() is in stdlib.h */ + +#include + +#include "netpbm/rand.h" + +static void +vinit(struct pm_randSt * const randStP) { + + randStP->max = RAND_MAX; + randStP->stateP = NULL; +} + + + +static void +vsrand(struct pm_randSt * const randStP, + unsigned int const seed) { + + srandom(seed); +} + + + +static unsigned long int +vrand(struct pm_randSt * const randStP) { + + return random(); +} + + +struct pm_rand_vtable const pm_randsysrandom_vtable = { + &vinit, + &vsrand, + &vrand +}; + + -- cgit 1.4.1