kern/subr_unit: Rip srandomdev, random(3) out of dead code

The simulation cannot be reproduced, so the value of using a deterministic PRNG
like random(3) is dubious.  The number of repitions used in the sample isn't a
problem for the Chacha implementation of arc4random we have today.  (Also, no
one actually runs this code; it was provided as an example of the work the
author did validating the implementation.  It's not even test code.)
This commit is contained in:
Conrad Meyer 2019-12-13 04:48:20 +00:00
parent c7b8411cc9
commit cd5650407e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355694

View File

@ -1021,7 +1021,7 @@ main(int argc, char **argv)
long count = 10000; /* Number of unrs to test */
long reps = 1, m;
int ch;
u_int i, j;
u_int i;
verbose = false;
@ -1055,20 +1055,18 @@ main(int argc, char **argv)
a = calloc(count, sizeof(char));
if (a == NULL)
err(1, "calloc failed");
srandomdev();
printf("sizeof(struct unr) %zu\n", sizeof(struct unr));
printf("sizeof(struct unrb) %zu\n", sizeof(struct unrb));
printf("sizeof(struct unrhdr) %zu\n", sizeof(struct unrhdr));
printf("NBITS %lu\n", (unsigned long)NBITS);
for (m = 0; m < count * reps; m++) {
j = random();
i = (j >> 1) % count;
i = arc4random_uniform(count);
#if 0
if (a[i] && (j & 1))
continue;
#endif
if ((random() & 1) != 0)
if ((arc4random() & 1) != 0)
test_alloc_unr(uh, i, a);
else
test_alloc_unr_specific(uh, i, a);