Skip to content

Commit 3c4a807

Browse files
committed
Fix std_rand feature
1 parent c1af60c commit 3c4a807

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/rand_custom.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
#[cfg(not(feature = "std"))]
2-
pub(crate) use rand::rngs::SmallRng as RngImpl;
3-
#[cfg(feature = "std")]
4-
pub(crate) use rand::rngs::StdRng as RngImpl;
1+
#[cfg(not(feature = "std_rand"))]
2+
pub use rand::rngs::SmallRng as RngImpl;
3+
#[cfg(feature = "std_rand")]
4+
pub use rand::rngs::StdRng as RngImpl;
55
use rand::SeedableRng;
66

7-
pub(crate) fn get_rng_impl(seed: Option<u64>) -> RngImpl {
7+
/// Custom switch for random fuctions
8+
pub fn get_rng_impl(seed: Option<u64>) -> RngImpl {
89
match seed {
910
Some(seed) => RngImpl::seed_from_u64(seed),
1011
None => {
1112
cfg_if::cfg_if! {
12-
if #[cfg(feature = "std")] {
13+
if #[cfg(feature = "std_rand")] {
1314
use rand::RngCore;
1415
RngImpl::seed_from_u64(rand::thread_rng().next_u64())
1516
} else {
16-
// non-std build, use getrandom
17+
// no std_random feature build, use getrandom
1718
let mut buf = [0u8; 64];
1819
getrandom::getrandom(&mut buf).unwrap();
1920
RngImpl::seed_from_u64(buf[0] as u64)

0 commit comments

Comments
 (0)