#getrandom #randomness #compile #returning #data #random #wraps

possiblyrandom

A crate that wraps getrandom and always compiles, returning 0s when no randomness is available

2 releases

new 0.1.1 Apr 19, 2024
0.1.0 Feb 12, 2024

#2 in #returning

Download history 75/week @ 2024-02-12 54/week @ 2024-02-19 30/week @ 2024-02-26 13/week @ 2024-03-04 4/week @ 2024-03-11 14/week @ 2024-04-01 113/week @ 2024-04-15

127 downloads per month

MIT/Apache

4KB

getrandom provides access to OS randomness, but will fail to compile on platforms that do not support fetching OS randomness. This is exactly what you want when you're doing cryptographic operations, but when you're just opportunistically randomizing, we're fine with compiling and simply disabling randomization.

This crate does that, returning only possibly-random data.

Note that this crate only enables getrandom on a subset of platforms it supports. As getrandom evolves this crate is unlikely to carefully track all getrandom-supported platforms, however will use random data on popular platforms.

Dependencies

~125KB