Vitamin C Random
A carefully designed random number generator that is safe to use for cryptographic purposes.
This crate is part of the Vitamin C framework to make cryptography code healthy.
Generatable
Types implementing the [Generatable] trait can be generated randomly using [SafeRand].
use ;
let mut rng = from_entropy;
let x: = random.unwrap;
You can implement Generatable for your own types using the derive macro:
use ;
// Create a random number generator and generate an instance of MyStruct.
let mut rng = from_entropy;
let instance: MyStruct = random.unwrap;
println!;
Bounded Random Numbers
The BoundedRng trait provides a way to generate random numbers within a specific range.
use ;
let mut rng = from_entropy;
let value: u32 = rng.next_bounded;
assert!;
Or using a Protected value:
use ;
use ;
let mut rng = from_entropy;
let value: = rng.next_bounded;
assert!;
CipherStash
Vitamin C is brought to you by the team at CipherStash.
License: MIT