@@ -49,21 +49,21 @@ fn gen_bytes(c: &mut Criterion<CyclesPerByte>) {
49
49
} ;
50
50
}
51
51
52
- gen_bytes ! ( "xorshift" , XorShiftRng :: from_entropy ( ) ) ;
53
- gen_bytes ! ( "xoshiro256starstar" , Xoshiro256StarStar :: from_entropy ( ) ) ;
54
- gen_bytes ! ( "xoshiro256plus" , Xoshiro256Plus :: from_entropy ( ) ) ;
55
- gen_bytes ! ( "xoshiro256plusplus" , Xoshiro256PlusPlus :: from_entropy ( ) ) ;
56
- gen_bytes ! ( "xoshiro128starstar" , Xoshiro128StarStar :: from_entropy ( ) ) ;
57
- gen_bytes ! ( "xoshiro128plus" , Xoshiro128Plus :: from_entropy ( ) ) ;
58
- gen_bytes ! ( "xoshiro128plusplus" , Xoshiro128PlusPlus :: from_entropy ( ) ) ;
59
- gen_bytes ! ( "xoroshiro128starstar" , Xoroshiro128StarStar :: from_entropy ( ) ) ;
60
- gen_bytes ! ( "xoroshiro128plus" , Xoroshiro128Plus :: from_entropy ( ) ) ;
61
- gen_bytes ! ( "xoroshiro64starstar" , Xoroshiro64StarStar :: from_entropy ( ) ) ;
62
- gen_bytes ! ( "xoroshiro64star" , Xoroshiro64Star :: from_entropy ( ) ) ;
63
- gen_bytes ! ( "splitmix64" , SplitMix64 :: from_entropy ( ) ) ;
64
- gen_bytes ! ( "hc128" , Hc128Rng :: from_entropy ( ) ) ;
65
- gen_bytes ! ( "isaac" , IsaacRng :: from_entropy ( ) ) ;
66
- gen_bytes ! ( "isaac64" , Isaac64Rng :: from_entropy ( ) ) ;
52
+ gen_bytes ! ( "xorshift" , XorShiftRng :: from_os_rng ( ) ) ;
53
+ gen_bytes ! ( "xoshiro256starstar" , Xoshiro256StarStar :: from_os_rng ( ) ) ;
54
+ gen_bytes ! ( "xoshiro256plus" , Xoshiro256Plus :: from_os_rng ( ) ) ;
55
+ gen_bytes ! ( "xoshiro256plusplus" , Xoshiro256PlusPlus :: from_os_rng ( ) ) ;
56
+ gen_bytes ! ( "xoshiro128starstar" , Xoshiro128StarStar :: from_os_rng ( ) ) ;
57
+ gen_bytes ! ( "xoshiro128plus" , Xoshiro128Plus :: from_os_rng ( ) ) ;
58
+ gen_bytes ! ( "xoshiro128plusplus" , Xoshiro128PlusPlus :: from_os_rng ( ) ) ;
59
+ gen_bytes ! ( "xoroshiro128starstar" , Xoroshiro128StarStar :: from_os_rng ( ) ) ;
60
+ gen_bytes ! ( "xoroshiro128plus" , Xoroshiro128Plus :: from_os_rng ( ) ) ;
61
+ gen_bytes ! ( "xoroshiro64starstar" , Xoroshiro64StarStar :: from_os_rng ( ) ) ;
62
+ gen_bytes ! ( "xoroshiro64star" , Xoroshiro64Star :: from_os_rng ( ) ) ;
63
+ gen_bytes ! ( "splitmix64" , SplitMix64 :: from_os_rng ( ) ) ;
64
+ gen_bytes ! ( "hc128" , Hc128Rng :: from_os_rng ( ) ) ;
65
+ gen_bytes ! ( "isaac" , IsaacRng :: from_os_rng ( ) ) ;
66
+ gen_bytes ! ( "isaac64" , Isaac64Rng :: from_os_rng ( ) ) ;
67
67
}
68
68
69
69
// Save a dependency on Rand:
@@ -105,102 +105,102 @@ fn gen_uint(c: &mut Criterion<CyclesPerByte>) {
105
105
let mut g = c. benchmark_group ( "gen_u32" ) ;
106
106
g. throughput ( Throughput :: Bytes ( size_of :: < u32 > ( ) as u64 * RAND_BENCH_N ) ) ;
107
107
108
- gen_uint ! ( g, "xorshift" , u32 , XorShiftRng :: from_entropy ( ) ) ;
108
+ gen_uint ! ( g, "xorshift" , u32 , XorShiftRng :: from_os_rng ( ) ) ;
109
109
gen_uint ! (
110
110
g,
111
111
"xoshiro256starstar" ,
112
112
u32 ,
113
- Xoshiro256StarStar :: from_entropy ( )
113
+ Xoshiro256StarStar :: from_os_rng ( )
114
114
) ;
115
- gen_uint ! ( g, "xoshiro256plus" , u32 , Xoshiro256Plus :: from_entropy ( ) ) ;
115
+ gen_uint ! ( g, "xoshiro256plus" , u32 , Xoshiro256Plus :: from_os_rng ( ) ) ;
116
116
gen_uint ! (
117
117
g,
118
118
"xoshiro256plusplus" ,
119
119
u32 ,
120
- Xoshiro256PlusPlus :: from_entropy ( )
120
+ Xoshiro256PlusPlus :: from_os_rng ( )
121
121
) ;
122
122
gen_uint ! (
123
123
g,
124
124
"xoshiro128starstar" ,
125
125
u32 ,
126
- Xoshiro128StarStar :: from_entropy ( )
126
+ Xoshiro128StarStar :: from_os_rng ( )
127
127
) ;
128
- gen_uint ! ( g, "xoshiro128plus" , u32 , Xoshiro128Plus :: from_entropy ( ) ) ;
128
+ gen_uint ! ( g, "xoshiro128plus" , u32 , Xoshiro128Plus :: from_os_rng ( ) ) ;
129
129
gen_uint ! (
130
130
g,
131
131
"xoshiro128plusplus" ,
132
132
u32 ,
133
- Xoshiro128PlusPlus :: from_entropy ( )
133
+ Xoshiro128PlusPlus :: from_os_rng ( )
134
134
) ;
135
135
gen_uint ! (
136
136
g,
137
137
"xoroshiro128starstar" ,
138
138
u32 ,
139
- Xoroshiro128StarStar :: from_entropy ( )
139
+ Xoroshiro128StarStar :: from_os_rng ( )
140
140
) ;
141
- gen_uint ! ( g, "xoroshiro128plus" , u32 , Xoroshiro128Plus :: from_entropy ( ) ) ;
141
+ gen_uint ! ( g, "xoroshiro128plus" , u32 , Xoroshiro128Plus :: from_os_rng ( ) ) ;
142
142
gen_uint ! (
143
143
g,
144
144
"xoroshiro64starstar" ,
145
145
u32 ,
146
- Xoroshiro64StarStar :: from_entropy ( )
146
+ Xoroshiro64StarStar :: from_os_rng ( )
147
147
) ;
148
- gen_uint ! ( g, "xoroshiro64star" , u32 , Xoroshiro64Star :: from_entropy ( ) ) ;
149
- gen_uint ! ( g, "splitmix64" , u32 , SplitMix64 :: from_entropy ( ) ) ;
150
- gen_uint ! ( g, "hc128" , u32 , Hc128Rng :: from_entropy ( ) ) ;
151
- gen_uint ! ( g, "isaac" , u32 , IsaacRng :: from_entropy ( ) ) ;
152
- gen_uint ! ( g, "isaac64" , u32 , Isaac64Rng :: from_entropy ( ) ) ;
148
+ gen_uint ! ( g, "xoroshiro64star" , u32 , Xoroshiro64Star :: from_os_rng ( ) ) ;
149
+ gen_uint ! ( g, "splitmix64" , u32 , SplitMix64 :: from_os_rng ( ) ) ;
150
+ gen_uint ! ( g, "hc128" , u32 , Hc128Rng :: from_os_rng ( ) ) ;
151
+ gen_uint ! ( g, "isaac" , u32 , IsaacRng :: from_os_rng ( ) ) ;
152
+ gen_uint ! ( g, "isaac64" , u32 , Isaac64Rng :: from_os_rng ( ) ) ;
153
153
}
154
154
155
155
{
156
156
let mut g = c. benchmark_group ( "gen_u64" ) ;
157
157
g. throughput ( Throughput :: Bytes ( size_of :: < u64 > ( ) as u64 * RAND_BENCH_N ) ) ;
158
158
159
- gen_uint ! ( g, "xorshift" , u64 , XorShiftRng :: from_entropy ( ) ) ;
159
+ gen_uint ! ( g, "xorshift" , u64 , XorShiftRng :: from_os_rng ( ) ) ;
160
160
gen_uint ! (
161
161
g,
162
162
"xoshiro256starstar" ,
163
163
u64 ,
164
- Xoshiro256StarStar :: from_entropy ( )
164
+ Xoshiro256StarStar :: from_os_rng ( )
165
165
) ;
166
- gen_uint ! ( g, "xoshiro256plus" , u64 , Xoshiro256Plus :: from_entropy ( ) ) ;
166
+ gen_uint ! ( g, "xoshiro256plus" , u64 , Xoshiro256Plus :: from_os_rng ( ) ) ;
167
167
gen_uint ! (
168
168
g,
169
169
"xoshiro256plusplus" ,
170
170
u64 ,
171
- Xoshiro256PlusPlus :: from_entropy ( )
171
+ Xoshiro256PlusPlus :: from_os_rng ( )
172
172
) ;
173
173
gen_uint ! (
174
174
g,
175
175
"xoshiro128starstar" ,
176
176
u64 ,
177
- Xoshiro128StarStar :: from_entropy ( )
177
+ Xoshiro128StarStar :: from_os_rng ( )
178
178
) ;
179
- gen_uint ! ( g, "xoshiro128plus" , u64 , Xoshiro128Plus :: from_entropy ( ) ) ;
179
+ gen_uint ! ( g, "xoshiro128plus" , u64 , Xoshiro128Plus :: from_os_rng ( ) ) ;
180
180
gen_uint ! (
181
181
g,
182
182
"xoshiro128plusplus" ,
183
183
u64 ,
184
- Xoshiro128PlusPlus :: from_entropy ( )
184
+ Xoshiro128PlusPlus :: from_os_rng ( )
185
185
) ;
186
186
gen_uint ! (
187
187
g,
188
188
"xoroshiro128starstar" ,
189
189
u64 ,
190
- Xoroshiro128StarStar :: from_entropy ( )
190
+ Xoroshiro128StarStar :: from_os_rng ( )
191
191
) ;
192
- gen_uint ! ( g, "xoroshiro128plus" , u64 , Xoroshiro128Plus :: from_entropy ( ) ) ;
192
+ gen_uint ! ( g, "xoroshiro128plus" , u64 , Xoroshiro128Plus :: from_os_rng ( ) ) ;
193
193
gen_uint ! (
194
194
g,
195
195
"xoroshiro64starstar" ,
196
196
u64 ,
197
- Xoroshiro64StarStar :: from_entropy ( )
197
+ Xoroshiro64StarStar :: from_os_rng ( )
198
198
) ;
199
- gen_uint ! ( g, "xoroshiro64star" , u64 , Xoroshiro64Star :: from_entropy ( ) ) ;
200
- gen_uint ! ( g, "splitmix64" , u64 , SplitMix64 :: from_entropy ( ) ) ;
201
- gen_uint ! ( g, "hc128" , u64 , Hc128Rng :: from_entropy ( ) ) ;
202
- gen_uint ! ( g, "isaac" , u64 , IsaacRng :: from_entropy ( ) ) ;
203
- gen_uint ! ( g, "isaac64" , u64 , Isaac64Rng :: from_entropy ( ) ) ;
199
+ gen_uint ! ( g, "xoroshiro64star" , u64 , Xoroshiro64Star :: from_os_rng ( ) ) ;
200
+ gen_uint ! ( g, "splitmix64" , u64 , SplitMix64 :: from_os_rng ( ) ) ;
201
+ gen_uint ! ( g, "hc128" , u64 , Hc128Rng :: from_os_rng ( ) ) ;
202
+ gen_uint ! ( g, "isaac" , u64 , IsaacRng :: from_os_rng ( ) ) ;
203
+ gen_uint ! ( g, "isaac64" , u64 , Isaac64Rng :: from_os_rng ( ) ) ;
204
204
}
205
205
}
206
206
@@ -210,8 +210,8 @@ fn init(c: &mut Criterion) {
210
210
macro_rules! init_gen {
211
211
( $fnn: expr, $gen: ident) => {
212
212
g. bench_function( $fnn, |b| {
213
- let mut rng = XorShiftRng :: from_entropy ( ) ;
214
- b. iter( || $gen:: from_rng( black_box( & mut rng) ) . unwrap ( ) )
213
+ let mut rng = XorShiftRng :: from_os_rng ( ) ;
214
+ b. iter( || $gen:: from_rng( black_box( & mut rng) ) )
215
215
} ) ;
216
216
} ;
217
217
}
0 commit comments