Skip to content

Instantly share code, notes, and snippets.

@urbanautomaton
Created June 20, 2019 16:31
Show Gist options
  • Save urbanautomaton/94f85d003be11e0cca072e00651535ff to your computer and use it in GitHub Desktop.
Save urbanautomaton/94f85d003be11e0cca072e00651535ff to your computer and use it in GitHub Desktop.
[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"
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