78 releases (25 stable)

3.4.1 Nov 5, 2024
3.3.0 Sep 24, 2024
3.2.0 Jul 8, 2024
3.0.0 Jan 11, 2024
0.6.0 Nov 10, 2020

#209 in Algorithms

Download history 37541/week @ 2024-08-02 41045/week @ 2024-08-09 42132/week @ 2024-08-16 35454/week @ 2024-08-23 38942/week @ 2024-08-30 39280/week @ 2024-09-06 41317/week @ 2024-09-13 41882/week @ 2024-09-20 38525/week @ 2024-09-27 47442/week @ 2024-10-04 31631/week @ 2024-10-11 38020/week @ 2024-10-18 38960/week @ 2024-10-25 48701/week @ 2024-11-01 39996/week @ 2024-11-08 50142/week @ 2024-11-15

184,415 downloads per month
Used in 201 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