aboutsummaryrefslogtreecommitdiff
path: root/core/src/util/mod.rs
blob: ec59e1cc7fc6de190fb447f927b5f5f21034befd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mod decode;
mod encode;
mod path;

pub use decode::decode;
pub use encode::{encode, encode_into_slice};
pub use path::{home_dir, tilde_expand};

use rand::{rngs::OsRng, Rng};

/// Generates and returns a random u32 using `rand::rngs::OsRng`.
pub fn random_32() -> u32 {
    OsRng.gen()
}

/// Generates and returns a random u64 using `rand::rngs::OsRng`.
pub fn random_64() -> u64 {
    OsRng.gen()
}

/// Generates and returns a random u16 using `rand::rngs::OsRng`.
pub fn random_16() -> u16 {
    OsRng.gen()
}