File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 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 ;
5
5
use rand:: SeedableRng ;
6
6
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 {
8
9
match seed {
9
10
Some ( seed) => RngImpl :: seed_from_u64 ( seed) ,
10
11
None => {
11
12
cfg_if:: cfg_if! {
12
- if #[ cfg( feature = "std " ) ] {
13
+ if #[ cfg( feature = "std_rand " ) ] {
13
14
use rand:: RngCore ;
14
15
RngImpl :: seed_from_u64( rand:: thread_rng( ) . next_u64( ) )
15
16
} else {
16
- // non-std build, use getrandom
17
+ // no std_random feature build, use getrandom
17
18
let mut buf = [ 0u8 ; 64 ] ;
18
19
getrandom:: getrandom( & mut buf) . unwrap( ) ;
19
20
RngImpl :: seed_from_u64( buf[ 0 ] as u64 )
You can’t perform that action at this time.
0 commit comments