#random #rng

cap-rand

Capability-based random number generators

45 releases (21 breaking)

new 0.25.2 Jun 29, 2022
0.24.4 May 26, 2022
0.24.2 Mar 16, 2022
0.22.0 Dec 16, 2021
0.6.0 Nov 10, 2020

#73 in Algorithms

Download history 5248/week @ 2022-03-15 4939/week @ 2022-03-22 9551/week @ 2022-03-29 10096/week @ 2022-04-05 7662/week @ 2022-04-12 9805/week @ 2022-04-19 9764/week @ 2022-04-26 7737/week @ 2022-05-03 8812/week @ 2022-05-10 7700/week @ 2022-05-17 5588/week @ 2022-05-24 6706/week @ 2022-05-31 5913/week @ 2022-06-07 3861/week @ 2022-06-14 6729/week @ 2022-06-21 6488/week @ 2022-06-28

24,747 downloads per month
Used in 29 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

~335KB