72 releases (19 stable)

3.0.0 Jan 11, 2024
2.0.1 Jan 2, 2024
2.0.0 Jun 30, 2023
1.0.16 Jun 29, 2023
0.6.0 Nov 10, 2020

#188 in Algorithms

Download history 31529/week @ 2024-01-18 30873/week @ 2024-01-25 33225/week @ 2024-02-01 28073/week @ 2024-02-08 30705/week @ 2024-02-15 32388/week @ 2024-02-22 32032/week @ 2024-02-29 30121/week @ 2024-03-07 28795/week @ 2024-03-14 29876/week @ 2024-03-21 30562/week @ 2024-03-28 28594/week @ 2024-04-04 31115/week @ 2024-04-11 36141/week @ 2024-04-18 35631/week @ 2024-04-25 30021/week @ 2024-05-02

137,208 downloads per month
Used in 170 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

~325KB