Registry / crypto / rdrand

rdrand

JSON →
library0.8.3rscratesunverified

An implementation of random number generator based on rdrand and rdseed instructions.

# Cargo.toml [dependencies] rdrand = "0.8.3"
INSTALL
IMPORT
SIG · RDRAND
R
rdrand
cryptorustv0.8.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RdRand
use rdrand::RdRand;

Generate a random number using hardware RNG.

use rdrand::RdRand; fn main() { let mut rng = RdRand::new().expect("rdrand not supported"); let val: u64 = rng.gen(); println!("Random value: {}", val); }
Debug
Known issues
gotchaRequires CPU support for rdrand/rdseed instructions; will panic if unavailable.
fix
Check CPU support before use or use fallback RNG.
affects: >=0.8.0
Upgrade
Version history
0.8.3latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Amazon
1
Resources
rdrand — cargo add rdrand · libregistry