Created
June 20, 2019 16:31
-
-
Save urbanautomaton/94f85d003be11e0cca072e00651535ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "rand_experiment" | |
version = "0.1.0" | |
authors = ["Simon Coffey <[email protected]>"] | |
edition = "2018" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
rand = "0.7.0-pre.1" | |
rand_xoshiro = "0.3.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rand::prelude::*; | |
use rand_xoshiro::rand_core::SeedableRng; | |
use rand_xoshiro::Xoshiro256StarStar; | |
fn mygen<R: Rng>(rng: &mut R) -> [f64; 3] { | |
rng.gen() | |
} | |
fn main() { | |
// let mut rng = StepRng::new(2, 1); | |
let mut rng = Xoshiro256StarStar::seed_from_u64(0); | |
for _ in 0..100 { | |
let x = mygen(&mut rng); | |
println!("Random: {:?}", x); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment