@@ -20,14 +20,9 @@ use test::{black_box, Bencher};
20
20
use rand:: prelude:: * ;
21
21
use rand:: rngs:: adapter:: ReseedingRng ;
22
22
use rand:: rngs:: { OsRng , mock:: StepRng } ;
23
- use rand_isaac:: { IsaacRng , Isaac64Rng } ;
24
23
use rand_chacha:: { ChaCha20Core , ChaCha8Rng , ChaCha12Rng , ChaCha20Rng } ;
25
24
use rand_hc:: { Hc128Rng } ;
26
25
use rand_pcg:: { Pcg32 , Pcg64 , Pcg64Mcg } ;
27
- use rand_xorshift:: XorShiftRng ;
28
- use rand_xoshiro:: { Xoshiro256StarStar , Xoshiro256Plus , Xoshiro128StarStar ,
29
- Xoshiro128Plus , Xoroshiro128StarStar , Xoroshiro128Plus , SplitMix64 ,
30
- Xoroshiro64StarStar , Xoroshiro64Star } ;
31
26
32
27
macro_rules! gen_bytes {
33
28
( $fnn: ident, $gen: expr) => {
@@ -47,25 +42,13 @@ macro_rules! gen_bytes {
47
42
}
48
43
49
44
gen_bytes ! ( gen_bytes_step, StepRng :: new( 0 , 1 ) ) ;
50
- gen_bytes ! ( gen_bytes_xorshift, XorShiftRng :: from_entropy( ) ) ;
51
- gen_bytes ! ( gen_bytes_xoshiro256starstar, Xoshiro256StarStar :: from_entropy( ) ) ;
52
- gen_bytes ! ( gen_bytes_xoshiro256plus, Xoshiro256Plus :: from_entropy( ) ) ;
53
- gen_bytes ! ( gen_bytes_xoshiro128starstar, Xoshiro128StarStar :: from_entropy( ) ) ;
54
- gen_bytes ! ( gen_bytes_xoshiro128plus, Xoshiro128Plus :: from_entropy( ) ) ;
55
- gen_bytes ! ( gen_bytes_xoroshiro128starstar, Xoroshiro128StarStar :: from_entropy( ) ) ;
56
- gen_bytes ! ( gen_bytes_xoroshiro128plus, Xoroshiro128Plus :: from_entropy( ) ) ;
57
- gen_bytes ! ( gen_bytes_xoroshiro64starstar, Xoroshiro64StarStar :: from_entropy( ) ) ;
58
- gen_bytes ! ( gen_bytes_xoroshiro64star, Xoroshiro64Star :: from_entropy( ) ) ;
59
- gen_bytes ! ( gen_bytes_splitmix64, SplitMix64 :: from_entropy( ) ) ;
60
45
gen_bytes ! ( gen_bytes_pcg32, Pcg32 :: from_entropy( ) ) ;
61
46
gen_bytes ! ( gen_bytes_pcg64, Pcg64 :: from_entropy( ) ) ;
62
47
gen_bytes ! ( gen_bytes_pcg64mcg, Pcg64Mcg :: from_entropy( ) ) ;
63
48
gen_bytes ! ( gen_bytes_chacha8, ChaCha8Rng :: from_entropy( ) ) ;
64
49
gen_bytes ! ( gen_bytes_chacha12, ChaCha12Rng :: from_entropy( ) ) ;
65
50
gen_bytes ! ( gen_bytes_chacha20, ChaCha20Rng :: from_entropy( ) ) ;
66
51
gen_bytes ! ( gen_bytes_hc128, Hc128Rng :: from_entropy( ) ) ;
67
- gen_bytes ! ( gen_bytes_isaac, IsaacRng :: from_entropy( ) ) ;
68
- gen_bytes ! ( gen_bytes_isaac64, Isaac64Rng :: from_entropy( ) ) ;
69
52
gen_bytes ! ( gen_bytes_std, StdRng :: from_entropy( ) ) ;
70
53
#[ cfg( feature="small_rng" ) ]
71
54
gen_bytes ! ( gen_bytes_small, SmallRng :: from_entropy( ) ) ;
@@ -89,50 +72,26 @@ macro_rules! gen_uint {
89
72
}
90
73
91
74
gen_uint ! ( gen_u32_step, u32 , StepRng :: new( 0 , 1 ) ) ;
92
- gen_uint ! ( gen_u32_xorshift, u32 , XorShiftRng :: from_entropy( ) ) ;
93
- gen_uint ! ( gen_u32_xoshiro256starstar, u32 , Xoshiro256StarStar :: from_entropy( ) ) ;
94
- gen_uint ! ( gen_u32_xoshiro256plus, u32 , Xoshiro256Plus :: from_entropy( ) ) ;
95
- gen_uint ! ( gen_u32_xoshiro128starstar, u32 , Xoshiro128StarStar :: from_entropy( ) ) ;
96
- gen_uint ! ( gen_u32_xoshiro128plus, u32 , Xoshiro128Plus :: from_entropy( ) ) ;
97
- gen_uint ! ( gen_u32_xoroshiro128starstar, u32 , Xoroshiro128StarStar :: from_entropy( ) ) ;
98
- gen_uint ! ( gen_u32_xoroshiro128plus, u32 , Xoroshiro128Plus :: from_entropy( ) ) ;
99
- gen_uint ! ( gen_u32_xoroshiro64starstar, u32 , Xoroshiro64StarStar :: from_entropy( ) ) ;
100
- gen_uint ! ( gen_u32_xoroshiro64star, u32 , Xoroshiro64Star :: from_entropy( ) ) ;
101
- gen_uint ! ( gen_u32_splitmix64, u32 , SplitMix64 :: from_entropy( ) ) ;
102
75
gen_uint ! ( gen_u32_pcg32, u32 , Pcg32 :: from_entropy( ) ) ;
103
76
gen_uint ! ( gen_u32_pcg64, u32 , Pcg64 :: from_entropy( ) ) ;
104
77
gen_uint ! ( gen_u32_pcg64mcg, u32 , Pcg64Mcg :: from_entropy( ) ) ;
105
78
gen_uint ! ( gen_u32_chacha8, u32 , ChaCha8Rng :: from_entropy( ) ) ;
106
79
gen_uint ! ( gen_u32_chacha12, u32 , ChaCha12Rng :: from_entropy( ) ) ;
107
80
gen_uint ! ( gen_u32_chacha20, u32 , ChaCha20Rng :: from_entropy( ) ) ;
108
81
gen_uint ! ( gen_u32_hc128, u32 , Hc128Rng :: from_entropy( ) ) ;
109
- gen_uint ! ( gen_u32_isaac, u32 , IsaacRng :: from_entropy( ) ) ;
110
- gen_uint ! ( gen_u32_isaac64, u32 , Isaac64Rng :: from_entropy( ) ) ;
111
82
gen_uint ! ( gen_u32_std, u32 , StdRng :: from_entropy( ) ) ;
112
83
#[ cfg( feature="small_rng" ) ]
113
84
gen_uint ! ( gen_u32_small, u32 , SmallRng :: from_entropy( ) ) ;
114
85
gen_uint ! ( gen_u32_os, u32 , OsRng ) ;
115
86
116
87
gen_uint ! ( gen_u64_step, u64 , StepRng :: new( 0 , 1 ) ) ;
117
- gen_uint ! ( gen_u64_xorshift, u64 , XorShiftRng :: from_entropy( ) ) ;
118
- gen_uint ! ( gen_u64_xoshiro256starstar, u64 , Xoshiro256StarStar :: from_entropy( ) ) ;
119
- gen_uint ! ( gen_u64_xoshiro256plus, u64 , Xoshiro256Plus :: from_entropy( ) ) ;
120
- gen_uint ! ( gen_u64_xoshiro128starstar, u64 , Xoshiro128StarStar :: from_entropy( ) ) ;
121
- gen_uint ! ( gen_u64_xoshiro128plus, u64 , Xoshiro128Plus :: from_entropy( ) ) ;
122
- gen_uint ! ( gen_u64_xoroshiro128starstar, u64 , Xoroshiro128StarStar :: from_entropy( ) ) ;
123
- gen_uint ! ( gen_u64_xoroshiro128plus, u64 , Xoroshiro128Plus :: from_entropy( ) ) ;
124
- gen_uint ! ( gen_u64_xoroshiro64starstar, u64 , Xoroshiro64StarStar :: from_entropy( ) ) ;
125
- gen_uint ! ( gen_u64_xoroshiro64star, u64 , Xoroshiro64Star :: from_entropy( ) ) ;
126
- gen_uint ! ( gen_u64_splitmix64, u64 , SplitMix64 :: from_entropy( ) ) ;
127
88
gen_uint ! ( gen_u64_pcg32, u64 , Pcg32 :: from_entropy( ) ) ;
128
89
gen_uint ! ( gen_u64_pcg64, u64 , Pcg64 :: from_entropy( ) ) ;
129
90
gen_uint ! ( gen_u64_pcg64mcg, u64 , Pcg64Mcg :: from_entropy( ) ) ;
130
91
gen_uint ! ( gen_u64_chacha8, u64 , ChaCha8Rng :: from_entropy( ) ) ;
131
92
gen_uint ! ( gen_u64_chacha12, u64 , ChaCha12Rng :: from_entropy( ) ) ;
132
93
gen_uint ! ( gen_u64_chacha20, u64 , ChaCha20Rng :: from_entropy( ) ) ;
133
94
gen_uint ! ( gen_u64_hc128, u64 , Hc128Rng :: from_entropy( ) ) ;
134
- gen_uint ! ( gen_u64_isaac, u64 , IsaacRng :: from_entropy( ) ) ;
135
- gen_uint ! ( gen_u64_isaac64, u64 , Isaac64Rng :: from_entropy( ) ) ;
136
95
gen_uint ! ( gen_u64_std, u64 , StdRng :: from_entropy( ) ) ;
137
96
#[ cfg( feature="small_rng" ) ]
138
97
gen_uint ! ( gen_u64_small, u64 , SmallRng :: from_entropy( ) ) ;
@@ -142,7 +101,7 @@ macro_rules! init_gen {
142
101
( $fnn: ident, $gen: ident) => {
143
102
#[ bench]
144
103
fn $fnn( b: & mut Bencher ) {
145
- let mut rng = XorShiftRng :: from_entropy( ) ;
104
+ let mut rng = Pcg32 :: from_entropy( ) ;
146
105
b. iter( || {
147
106
let r2 = $gen:: from_rng( & mut rng) . unwrap( ) ;
148
107
r2
@@ -151,22 +110,10 @@ macro_rules! init_gen {
151
110
}
152
111
}
153
112
154
- init_gen ! ( init_xorshift, XorShiftRng ) ;
155
- init_gen ! ( init_xoshiro256starstar, Xoshiro256StarStar ) ;
156
- init_gen ! ( init_xoshiro256plus, Xoshiro256Plus ) ;
157
- init_gen ! ( init_xoshiro128starstar, Xoshiro128StarStar ) ;
158
- init_gen ! ( init_xoshiro128plus, Xoshiro128Plus ) ;
159
- init_gen ! ( init_xoroshiro128starstar, Xoroshiro128StarStar ) ;
160
- init_gen ! ( init_xoroshiro128plus, Xoroshiro128Plus ) ;
161
- init_gen ! ( init_xoroshiro64starstar, Xoroshiro64StarStar ) ;
162
- init_gen ! ( init_xoroshiro64star, Xoroshiro64Star ) ;
163
- init_gen ! ( init_splitmix64, SplitMix64 ) ;
164
113
init_gen ! ( init_pcg32, Pcg32 ) ;
165
114
init_gen ! ( init_pcg64, Pcg64 ) ;
166
115
init_gen ! ( init_pcg64mcg, Pcg64Mcg ) ;
167
116
init_gen ! ( init_hc128, Hc128Rng ) ;
168
- init_gen ! ( init_isaac, IsaacRng ) ;
169
- init_gen ! ( init_isaac64, Isaac64Rng ) ;
170
117
init_gen ! ( init_chacha, ChaCha20Rng ) ;
171
118
172
119
const RESEEDING_BYTES_LEN : usize = 1024 * 1024 ;
0 commit comments