mirror of
https://github.com/Magnus167/rustframe.git
synced 2025-11-19 23:16:11 +00:00
Enhance documentation with usage examples for random number generation utilities
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
//! Random number generation utilities.
|
||||
//!
|
||||
//! Provides both a simple pseudo-random generator [`Prng`](crate::random::Prng) and a
|
||||
//! cryptographically secure alternative [`CryptoRng`](crate::random::CryptoRng). The
|
||||
//! [`SliceRandom`](crate::random::SliceRandom) trait offers shuffling of slices using any RNG
|
||||
//! implementing [`Rng`](crate::random::Rng).
|
||||
//!
|
||||
//! ```
|
||||
//! use rustframe::random::{rng, SliceRandom};
|
||||
//!
|
||||
//! let mut rng = rng();
|
||||
//! let mut data = [1, 2, 3, 4];
|
||||
//! data.shuffle(&mut rng);
|
||||
//! assert_eq!(data.len(), 4);
|
||||
//! ```
|
||||
pub mod crypto;
|
||||
pub mod prng;
|
||||
pub mod random_core;
|
||||
|
||||
Reference in New Issue
Block a user