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

#171 in Algorithms

Download history 39142/week @ 2024-09-17 41470/week @ 2024-09-24 38610/week @ 2024-10-01 44210/week @ 2024-10-08 31508/week @ 2024-10-15 40696/week @ 2024-10-22 43466/week @ 2024-10-29 46601/week @ 2024-11-05 40516/week @ 2024-11-12 50166/week @ 2024-11-19 39725/week @ 2024-11-26 49617/week @ 2024-12-03 47368/week @ 2024-12-10 62962/week @ 2024-12-17 26159/week @ 2024-12-24 24286/week @ 2024-12-31

169,256 downloads per month
Used in 210 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

~335KB