~donmcc/lrnd

A random number library for C99
Created initial project skeleton.

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~donmcc/lrnd
read/write
git@git.sr.ht:~donmcc/lrnd

You can also use your local clone with git send-email.

#lrnd

A C99 library for generating random numbers.

builds.sr.ht status

#Overview

The lrnd library contains functions for generating random numbers using pluggable random number generators.

#Structs

struct lrnd {
    uint32_t const max_value;
    bool (*next_value)(uint32_t *value_out);
};

The max_value field contains the inclusive maximum value that the generator can produce. The next_value field contains a pointer to a function that generates the next random value for this generator.

#Functions

struct lrnd *
lrnd_get_stdlib_rand(void);

Retrieve a static instance of the rand() pseudo-random number generator.

bool
lrnd_next_value(struct lrnd *lrnd, uint32_t *value_out);

Generate the next random value for the given generator. Returns false and sets errno if generation fails.

#License

lrnd is made available under a BSD-style license; see the LICENSE file for details.