File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -46,11 +46,16 @@ jobs:
4646 - name : Install test runner for wasi
4747 if : matrix.platform.target == 'wasm32-wasi'
4848 run : curl https://wasmtime.dev/install.sh -sSf | bash
49- - name : Stable Build
49+ - name : Stable Build with all features
5050 uses : actions-rs/cargo@v1
5151 with :
5252 command : build
5353 args : --all-features --target ${{ matrix.platform.target }}
54+ - name : Stable Build without features
55+ uses : actions-rs/cargo@v1
56+ with :
57+ command : build
58+ args : --target ${{ matrix.platform.target }}
5459 - name : Tests
5560 if : matrix.platform.target == 'x86_64-unknown-linux-gnu' || matrix.platform.target == 'x86_64-pc-windows-msvc' || matrix.platform.target == 'aarch64-apple-darwin'
5661 uses : actions-rs/cargo@v1
Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ ndarray = { version = "0.15", optional = true }
2626num-traits = " 0.2.12"
2727num = " 0.4"
2828rand = { version = " 0.8.5" , default-features = false , features = [" small_rng" ] }
29- getrandom = " *"
3029rand_distr = { version = " 0.4" , optional = true }
3130serde = { version = " 1" , features = [" derive" ], optional = true }
3231
@@ -40,7 +39,7 @@ std_rand = ["rand/std_rng", "rand/std"]
4039js = [" getrandom/js" ]
4140
4241[target .'cfg(target_arch = "wasm32")' .dependencies ]
43- getrandom = { version = " *" , features = [ " js " ] }
42+ getrandom = { version = " *" , optional = true }
4443
4544[target .'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))' .dev-dependencies ]
4645wasm-bindgen-test = " 0.3"
Original file line number Diff line number Diff line change @@ -15,9 +15,17 @@ pub fn get_rng_impl(seed: Option<u64>) -> RngImpl {
1515 RngImpl :: seed_from_u64( rand:: thread_rng( ) . next_u64( ) )
1616 } else {
1717 // no std_random feature build, use getrandom
18- let mut buf = [ 0u8 ; 64 ] ;
19- getrandom:: getrandom( & mut buf) . unwrap( ) ;
20- RngImpl :: seed_from_u64( buf[ 0 ] as u64 )
18+ #[ cfg( feature = "js" ) ]
19+ {
20+ let mut buf = [ 0u8 ; 64 ] ;
21+ getrandom:: getrandom( & mut buf) . unwrap( ) ;
22+ RngImpl :: seed_from_u64( buf[ 0 ] as u64 )
23+ }
24+ #[ cfg( not( feature = "js" ) ) ]
25+ {
26+ // Using 0 as default seed
27+ RngImpl :: seed_from_u64( 0 )
28+ }
2129 }
2230 }
2331 }
You can’t perform that action at this time.
0 commit comments