~donmcc/lrnd

lrnd/lrnd.c -rw-r--r-- 395 bytes
fd8d136bDon McCaughey Created initial project skeleton. 3 months ago
                                                                                
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
#include "lrnd.h"

#include <stdlib.h>


static bool
stdlib_rand_next_value(uint32_t *value_out)
{
    *value_out = (uint32_t)rand();
    return true;
}


struct lrnd *const lrnd_stdlib_rand = &((struct lrnd){
    .max_value=RAND_MAX,        
    .next_value=stdlib_rand_next_value,
});


bool
lrnd_next_value(struct lrnd *lrnd, uint32_t *value_out)
{
    return lrnd->next_value(value_out);
}