about summary refs log tree commit diff
path: root/lib/util/randsysrand.c
blob: f97a5d3c7f5cb99a1a7b307412da6974b91183d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdlib.h>

#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) {

    srand(seed);
}



static unsigned long int
vrand(struct pm_randSt * const randStP) {

    return rand();
}



struct pm_rand_vtable const pm_randsysrand_vtable = {
    &vinit,
    &vsrand,
    &vrand
};