#random #generator #seed #no-alloc

no-std acorn_prng

A no_std, 0 dependency, pseudo-random number generator based on the ACORN algorithm

2 stable releases

3.0.1 Jul 20, 2023
3.0.0 Dec 12, 2022
2.0.1 Dec 10, 2022
2.0.0 Dec 9, 2022
1.0.1 Dec 8, 2022

#940 in Algorithms

Download history 170/week @ 2023-12-14 95/week @ 2023-12-21 95/week @ 2023-12-28 173/week @ 2024-01-04 164/week @ 2024-01-11 182/week @ 2024-01-18 207/week @ 2024-01-25 287/week @ 2024-02-01 237/week @ 2024-02-08 163/week @ 2024-02-15 230/week @ 2024-02-22 195/week @ 2024-02-29 237/week @ 2024-03-07 213/week @ 2024-03-14 224/week @ 2024-03-21 149/week @ 2024-03-28

847 downloads per month

ISC license

31KB
353 lines

acorn_prng

A no_std, 0 dependency, pseudo-random number generator library based on the ACORN algorithm. Not cryptographically secure.

Using this library

Add the following to the [dependencies] section of your Config.toml:

acorn_prng = "3.0.0"

Documentation

Documentation can be found here: https://docs.rs/acorn_prng

Acknowledgements

The ACORN algorithm is described here: http://acorn.wikramaratna.org/concept.html


lib.rs:

ACORN Pseudo-random Number Generator

This pseudo-random number generator is based on the ACORN algorithm.

It is a #![no_std] crate that does not require alloc and has no dependencies.

The numbers generated from this prng are not considered cryptographically secure.

Usage

Create a generator by specifying both the Order and the Seed. Allowing the user of this library to specify the starting data makes reproducability possible. If you do not require reproducable pseudo-random numbers then using the current time converted into a u128 for the Seed should provide sufficient randomness.

Then you can generate either a number of a fixed digit length or a number bewteen a specified range (inclusive).

Please see the Acorn struct documentation for examples.

No runtime deps