lrnd/README.md -rw-r--r-- 1.1 KiB
fd8d136bDon McCaughey Created initial project skeleton. 4 months ago


A C99 library for generating random numbers.

builds.sr.ht status


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


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.


struct lrnd *

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

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.


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