79 releases (26 stable)

new 3.4.2 Dec 4, 2024
3.4.1 Nov 5, 2024
3.4.0 Oct 30, 2024
3.2.0 Jul 8, 2024
0.6.0 Nov 10, 2020

#195 in Algorithms

Download history 41607/week @ 2024-08-17 36222/week @ 2024-08-24 40539/week @ 2024-08-31 39001/week @ 2024-09-07 40590/week @ 2024-09-14 40583/week @ 2024-09-21 38110/week @ 2024-09-28 47565/week @ 2024-10-05 31527/week @ 2024-10-12 38334/week @ 2024-10-19 41129/week @ 2024-10-26 47172/week @ 2024-11-02 40483/week @ 2024-11-09 51181/week @ 2024-11-16 37502/week @ 2024-11-23 51671/week @ 2024-11-30

187,015 downloads per month
Used in 203 crates (3 directly)

Apache-2.0…

9KB
103 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; use std_rng_from_entropy instead.

Dependencies

~330KB