File tree Expand file tree Collapse file tree 4 files changed +18
-14
lines changed Expand file tree Collapse file tree 4 files changed +18
-14
lines changed Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ edition = "2021"
12
12
libc = " 0.2"
13
13
num_cpus = " 1.10.1"
14
14
15
- getrandom_1 = { package = " getrandom" , version = " 0.1" }
16
- getrandom = { version = " 0.2" , features = [" js" ] }
15
+ getrandom_01 = { package = " getrandom" , version = " 0.1" }
16
+ getrandom_02 = { package = " getrandom " , version = " 0.2" , features = [" js" ] }
17
17
rand = { version = " 0.8" , features = [" small_rng" ] }
18
18
19
19
[target .'cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))' .dependencies ]
Original file line number Diff line number Diff line change
1
+ // mac-os `getrandom_01` does some pointer shenanigans
2
+ //@compile-flags: -Zmiri-permissive-provenance
3
+
4
+ /// Test direct calls of getrandom 0.1 and 0.2
5
+ fn main ( ) {
6
+ let mut data = vec ! [ 0 ; 16 ] ;
7
+ getrandom_01:: getrandom ( & mut data) . unwrap ( ) ;
8
+ getrandom_02:: getrandom ( & mut data) . unwrap ( ) ;
9
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
//@compile-flags: -Zmiri-strict-provenance
2
- use rand:: { rngs :: SmallRng , Rng , SeedableRng } ;
2
+ use rand:: prelude :: * ;
3
3
4
+ // Test using the `rand` crate to generate randomness.
4
5
fn main ( ) {
5
- // Test `getrandom` directly.
6
- let mut data = vec ! [ 0 ; 16 ] ;
7
- getrandom:: getrandom ( & mut data) . unwrap ( ) ;
6
+ // Fully deterministic seeding.
7
+ let mut rng = SmallRng :: seed_from_u64 ( 42 ) ;
8
+ let _val = rng. gen :: < i32 > ( ) ;
9
+ let _val = rng. gen :: < isize > ( ) ;
10
+ let _val = rng. gen :: < i128 > ( ) ;
8
11
9
12
// Try seeding with "real" entropy.
10
13
let mut rng = SmallRng :: from_entropy ( ) ;
You can’t perform that action at this time.
0 commit comments