#random

cap-rand

Capability-based random number generators

81 releases (28 stable)

3.4.4 Apr 21, 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

#502 in Algorithms

Download history 64129/week @ 2025-01-31 57445/week @ 2025-02-07 55858/week @ 2025-02-14 58006/week @ 2025-02-21 61984/week @ 2025-02-28 61597/week @ 2025-03-07 74469/week @ 2025-03-14 67710/week @ 2025-03-21 63857/week @ 2025-03-28 74843/week @ 2025-04-04 58197/week @ 2025-04-11 64500/week @ 2025-04-18 50312/week @ 2025-04-25 54228/week @ 2025-05-02 45576/week @ 2025-05-09 52402/week @ 2025-05-16

212,460 downloads per month
Used in 230 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

~350KB