1 #![allow(unused_imports)] // FIXME for macOS
5 use rand::{SeedableRng, FromEntropy, Rng, rngs::SmallRng};
12 // Having more than 1 test does seem to make a difference
13 // (i.e., this calls ptr::swap which having just one test does not).
16 let mut rng = rand::rngs::StdRng::seed_from_u64(0xdeadcafe);
17 let x: u32 = rng.gen();
18 let y: u32 = rng.gen();
24 // Use this opportunity to test querying the RNG (needs an external crate, hence tested here and not in the compiletest suite)
25 let mut rng = SmallRng::from_entropy();
26 let _val = rng.gen::<i32>();
28 // Also try per-thread RNG.
29 let mut rng = rand::thread_rng();
30 let _val = rng.gen::<i32>();
33 // A test that won't work on miri
36 fn does_not_work_on_miri() {
38 assert!(&x as *const _ as usize % 4 < 4);