anda_engine/
lib.rs

1use rand::Rng;
2
3pub mod context;
4pub mod engine;
5pub mod extension;
6pub mod model;
7pub mod store;
8
9/// Gets current unix timestamp in milliseconds
10pub use structured_logger::unix_ms;
11
12/// Generates N random bytes
13pub use ic_cose::rand_bytes;
14
15pub static APP_USER_AGENT: &str = concat!(
16    "Mozilla/5.0 anda.bot ",
17    env!("CARGO_PKG_NAME"),
18    "/",
19    env!("CARGO_PKG_VERSION"),
20);
21
22/// Generates a random number within the given range
23pub fn rand_number<T, R>(range: R) -> T
24where
25    T: rand::distributions::uniform::SampleUniform,
26    R: rand::distributions::uniform::SampleRange<T>,
27{
28    let mut rng = rand::thread_rng();
29    rng.gen_range(range)
30}