chore: reorg
This commit is contained in:
21
__crypto/random/src/main.rs
Normal file
21
__crypto/random/src/main.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use rand::distributions::{
|
||||
Distribution, Uniform,
|
||||
};
|
||||
use rand_core::RngCore;
|
||||
|
||||
fn main() {
|
||||
let mut rng = rand::thread_rng();
|
||||
|
||||
println!("10 rands u32");
|
||||
for _ in 0..10 {
|
||||
let u = rng.next_u32();
|
||||
println!("{}", u);
|
||||
}
|
||||
|
||||
println!("10 rands -1.0 ~ 1.0");
|
||||
let range = Uniform::new(-1.0f64, 1.0);
|
||||
for _ in 0..10 {
|
||||
let a = range.sample(&mut rng);
|
||||
println!("{}", a);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user