rostra-core 0.1.3

Signed event graph types for the Rostra protocol
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use rand::Rng as _;

use super::ShortEventId;

impl rand::distr::Distribution<ShortEventId> for rand::distr::StandardUniform {
    fn sample<R: rand::Rng + ?Sized>(&self, rng: &mut R) -> ShortEventId {
        let mut bytes = [0u8; 16];
        rng.fill_bytes(&mut bytes);
        ShortEventId(bytes)
    }
}
impl ShortEventId {
    pub fn random() -> Self {
        rand::rng().random()
    }
}