mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-01 08:27:59 +00:00
stress2: Replace random() with arc4random()
This commit is contained in:
parent
cb53f83d8a
commit
ff4a72c159
@ -137,7 +137,7 @@ write_file(void)
|
||||
unlink(path);
|
||||
}
|
||||
|
||||
fprintf(fp, "blah blah blah garbage %ld\n", random());
|
||||
fprintf(fp, "blah blah blah garbage %ld\n", (long)arc4random());
|
||||
fclose(fp);
|
||||
if (rename(path, filename) < 0) {
|
||||
warn("rename");
|
||||
@ -150,7 +150,7 @@ random_sleep(int base, int slop)
|
||||
{
|
||||
long val;
|
||||
|
||||
val = random() % slop;
|
||||
val = arc4random() % slop;
|
||||
usleep(base + val);
|
||||
}
|
||||
|
||||
|
@ -886,11 +886,12 @@ test(void)
|
||||
{
|
||||
unsigned long offset;
|
||||
unsigned long size = maxoplen;
|
||||
unsigned long rv = random();
|
||||
unsigned long rv;
|
||||
unsigned long op = rv % (3 + !lite + mapped_writes);
|
||||
|
||||
/* turn off the map read if necessary */
|
||||
|
||||
arc4random_buf(&rv, sizeof(rv));
|
||||
if (op == 2 && !mapped_reads)
|
||||
op = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user