#random #rng

cap-rand

Capability-based random number generators

36 releases (19 breaking)

new 0.23.0 Jan 21, 2022
0.22.0 Dec 16, 2021
0.21.1 Nov 12, 2021
0.16.3 Jul 14, 2021
0.6.0 Nov 10, 2020

#73 in Algorithms

Download history 2800/week @ 2021-10-01 3224/week @ 2021-10-08 4293/week @ 2021-10-15 3830/week @ 2021-10-22 3110/week @ 2021-10-29 2217/week @ 2021-11-05 3214/week @ 2021-11-12 2654/week @ 2021-11-19 2358/week @ 2021-11-26 2380/week @ 2021-12-03 3689/week @ 2021-12-10 2183/week @ 2021-12-17 884/week @ 2021-12-24 3037/week @ 2021-12-31 2967/week @ 2022-01-07 3880/week @ 2022-01-14

11,071 downloads per month
Used in 18 crates (2 directly)

Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT

9KB
95 lines

cap-rand

Capability-based random number generators

Github Actions CI Status crates.io page docs.rs docs

The cap-rand crate provides a capability-based interface to random number generators via the [rand] crate.


lib.rs:

Capability-based random number generators

This corresponds to [rand].

Capability-based APIs represent access to external resources as values which can be passed around between different parts of a program.

Two notable features are the OsRng and CapRng types, which wrap up access to the operating system entropy source in capability values.

This crate uses the existing rand::SeedableRng trait rather than having its own version, however while rand::SeedableRng is mostly just a pure interface, it provides a from_entropy function which directly reads from the operating system entropy source. To preserve the capability-based interface, avoid using rand::SeedableRng's from_entropy function on any of the types that implement that trait.

Dependencies

~345KB