79 releases (26 stable)

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

#482 in Algorithms

Download history 46863/week @ 2024-12-05 46235/week @ 2024-12-12 54383/week @ 2024-12-19 27388/week @ 2024-12-26 41015/week @ 2025-01-02 60864/week @ 2025-01-09 49138/week @ 2025-01-16 57907/week @ 2025-01-23 53968/week @ 2025-01-30 66659/week @ 2025-02-06 51212/week @ 2025-02-13 61146/week @ 2025-02-20 59928/week @ 2025-02-27 62371/week @ 2025-03-06 68501/week @ 2025-03-13 70464/week @ 2025-03-20

268,641 downloads per month
Used in 223 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

~345KB