| 1 |
#include <stdlib.h> |
| 2 |
|
| 3 |
#include "netpbm/rand.h" |
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
static void |
| 8 |
vinit(struct pm_randSt * const randStP) { |
| 9 |
|
| 10 |
randStP->max = RAND_MAX; |
| 11 |
randStP->stateP = NULL; |
| 12 |
} |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
static void |
| 17 |
vsrand(struct pm_randSt * const randStP, |
| 18 |
unsigned int const seed) { |
| 19 |
|
| 20 |
srand(seed); |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
static unsigned long int |
| 26 |
vrand(struct pm_randSt * const randStP) { |
| 27 |
|
| 28 |
return rand(); |
| 29 |
} |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
struct pm_rand_vtable const pm_randsysrand_vtable = { |
| 34 |
&vinit, |
| 35 |
&vsrand, |
| 36 |
&vrand |
| 37 |
}; |
| 38 |
|
| 39 |
|