80 releases (27 stable)

3.4.3 Apr 4, 2025
3.4.2 Dec 4, 2024
3.4.1 Nov 5, 2024
3.2.0 Jul 8, 2024
0.6.0 Nov 10, 2020

#493 in Algorithms

Download history 26958/week @ 2024-12-25 36435/week @ 2025-01-01 60089/week @ 2025-01-08 48106/week @ 2025-01-15 55638/week @ 2025-01-22 52499/week @ 2025-01-29 70888/week @ 2025-02-05 49120/week @ 2025-02-12 65104/week @ 2025-02-19 56115/week @ 2025-02-26 63087/week @ 2025-03-05 67348/week @ 2025-03-12 81765/week @ 2025-03-19 56705/week @ 2025-03-26 72294/week @ 2025-04-02 61542/week @ 2025-04-09

283,564 downloads per month
Used in 225 crates (3 directly)

Apache-2.0…

10KB
103 lines

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.


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.

Dependencies

~345KB