@@ -198,67 +198,65 @@ BOOST_AUTO_TEST_CASE(PrevectorTestInt)
198
198
for (int j = 0 ; j < 64 ; j++) {
199
199
prevector_tester<8 , int > test;
200
200
for (int i = 0 ; i < 2048 ; i++) {
201
- int r = insecure_rand ();
202
- if ((r % 4 ) == 0 ) {
201
+ if (insecure_randbits (2 ) == 0 ) {
203
202
test.insert (insecure_randrange (test.size () + 1 ), insecure_rand ());
204
203
}
205
- if (test.size () > 0 && ((r >> 2 ) % 4 ) == 1 ) {
204
+ if (test.size () > 0 && insecure_randbits ( 2 ) == 1 ) {
206
205
test.erase (insecure_randrange (test.size ()));
207
206
}
208
- if (((r >> 4 ) % 8 ) == 2 ) {
207
+ if (insecure_randbits ( 3 ) == 2 ) {
209
208
int new_size = std::max<int >(0 , std::min<int >(30 , test.size () + (insecure_randrange (5 )) - 2 ));
210
209
test.resize (new_size);
211
210
}
212
- if (((r >> 7 ) % 8 ) == 3 ) {
211
+ if (insecure_randbits ( 3 ) == 3 ) {
213
212
test.insert (insecure_randrange (test.size () + 1 ), 1 + insecure_randrange (2 ), insecure_rand ());
214
213
}
215
- if (((r >> 10 ) % 8 ) == 4 ) {
214
+ if (insecure_randbits ( 3 ) == 4 ) {
216
215
int del = std::min<int >(test.size (), 1 + (insecure_randrange (2 )));
217
216
int beg = insecure_randrange (test.size () + 1 - del);
218
217
test.erase (beg, beg + del);
219
218
}
220
- if (((r >> 13 ) % 16 ) == 5 ) {
219
+ if (insecure_randbits ( 4 ) == 5 ) {
221
220
test.push_back (insecure_rand ());
222
221
}
223
- if (test.size () > 0 && ((r >> 17 ) % 16 ) == 6 ) {
222
+ if (test.size () > 0 && insecure_randbits ( 4 ) == 6 ) {
224
223
test.pop_back ();
225
224
}
226
- if (((r >> 21 ) % 32 ) == 7 ) {
225
+ if (insecure_randbits ( 5 ) == 7 ) {
227
226
int values[4 ];
228
227
int num = 1 + (insecure_randrange (4 ));
229
228
for (int k = 0 ; k < num; k++) {
230
229
values[k] = insecure_rand ();
231
230
}
232
231
test.insert_range (insecure_randrange (test.size () + 1 ), values, values + num);
233
232
}
234
- if (((r >> 26 ) % 32 ) == 8 ) {
233
+ if (insecure_randbits ( 5 ) == 8 ) {
235
234
int del = std::min<int >(test.size (), 1 + (insecure_randrange (4 )));
236
235
int beg = insecure_randrange (test.size () + 1 - del);
237
236
test.erase (beg, beg + del);
238
237
}
239
- r = insecure_rand ();
240
- if (r % 32 == 9 ) {
238
+ if (insecure_randbits (5 ) == 9 ) {
241
239
test.reserve (insecure_randrange (32 ));
242
240
}
243
- if ((r >> 5 ) % 64 == 10 ) {
241
+ if (insecure_randbits ( 6 ) == 10 ) {
244
242
test.shrink_to_fit ();
245
243
}
246
244
if (test.size () > 0 ) {
247
245
test.update (insecure_randrange (test.size ()), insecure_rand ());
248
246
}
249
- if (((r >> 11 ) % 1024 ) == 11 ) {
247
+ if (insecure_randbits ( 10 ) == 11 ) {
250
248
test.clear ();
251
249
}
252
- if (((r >> 21 ) % 512 ) == 12 ) {
250
+ if (insecure_randbits ( 9 ) == 12 ) {
253
251
test.assign (insecure_randrange (32 ), insecure_rand ());
254
252
}
255
- if (((r >> 15 ) % 8 ) == 3 ) {
253
+ if (insecure_randbits ( 3 ) == 3 ) {
256
254
test.swap ();
257
255
}
258
- if (((r >> 15 ) % 16 ) == 8 ) {
256
+ if (insecure_randbits ( 4 ) == 8 ) {
259
257
test.copy ();
260
258
}
261
- if (((r >> 15 ) % 32 ) == 18 ) {
259
+ if (insecure_randbits ( 5 ) == 18 ) {
262
260
test.move ();
263
261
}
264
262
}
0 commit comments