Lmm/add seeds in more algorithms (#164)

* Provide better output in flaky tests

* feat: add seed parameter to multiple algorithms

* Update changelog

Co-authored-by: Luis Moreno <morenol@users.noreply.github.com>
This commit is contained in:
morenol
2022-09-21 15:35:22 -04:00
parent 55e1158581
commit a37b552a7d
14 changed files with 139 additions and 64 deletions
+21
View File
@@ -0,0 +1,21 @@
use ::rand::SeedableRng;
#[cfg(not(feature = "std"))]
use rand::rngs::SmallRng as RngImpl;
#[cfg(feature = "std")]
use rand::rngs::StdRng as RngImpl;
pub(crate) fn get_rng_impl(seed: Option<u64>) -> RngImpl {
match seed {
Some(seed) => RngImpl::seed_from_u64(seed),
None => {
cfg_if::cfg_if! {
if #[cfg(feature = "std")] {
use rand::RngCore;
RngImpl::seed_from_u64(rand::thread_rng().next_u64())
} else {
panic!("seed number needed for non-std build");
}
}
}
}
}