souvenir 0.4.1

Prefixed identifier library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::{Id, Type};
use rand::{Rng, random};

impl<T: Type> Id<T> {
    /// Generate an [`Id<T>`] with a random value.
    pub fn random() -> Self {
        Self::new(random())
    }

    /// Generate a random [`Id<T>`] with the provided RNG.
    pub fn random_with<R: Rng + ?Sized>(rng: &mut R) -> Self {
        Self::new(rng.random())
    }
}