Created
June 19, 2019 13:04
-
-
Save urbanautomaton/874ce67d4c602b71bdb1c6d55f9a4e17 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.6.5" | |
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::Rng; | |
use rand_xoshiro::rand_core::*; | |
use rand_xoshiro::Xoshiro256StarStar; | |
fn wat<R: Rng>(rng: &mut R) -> f64 { | |
rng.gen() | |
} | |
fn main() { | |
let mut rng = Xoshiro256StarStar::seed_from_u64(0); | |
for i in 0..100 { | |
let x: f64 = wat(&mut rng); | |
println!("Random: {}", x); | |
} | |
} |
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
Compiling rand_experiment v0.1.0 (/Users/simon/dev/personal/computation_club/rand_experiment) | |
error[E0277]: the trait bound `rand_xoshiro::xoshiro256starstar::Xoshiro256StarStar: rand_core::RngCore` is not satisfied | |
--> src/main.rs:13:22 | |
| | |
13 | let x: f64 = wat(&mut rng); | |
| ^^^ the trait `rand_core::RngCore` is not implemented for `rand_xoshiro::xoshiro256starstar::Xoshiro256StarStar` | |
| | |
= note: required because of the requirements on the impl of `rand::Rng` for `rand_xoshiro::xoshiro256starstar::Xoshiro256StarStar` | |
note: required by `wat` | |
--> src/main.rs:5:1 | |
| | |
5 | fn wat<R: Rng>(rng: &mut R) -> f64 { | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
error: aborting due to previous error | |
For more information about this error, try `rustc --explain E0277`. | |
error: Could not compile `rand_experiment`. | |
To learn more, run the command again with --verbose. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment