Use better PRNG

This commit is contained in:
Neale Pickett 2024-01-22 16:26:38 -07:00
parent c5739314d3
commit f52b480d1a
1 changed files with 2 additions and 5 deletions

7
baud.c
View File

@ -55,9 +55,6 @@ main(int argc, char *argv[]) {
noiselen = atoi(argv[3]);
}
// In musl, the first value is 0
rand();
int cps = baud / 10; // 8N1 has 10 bits per octet: 8 data, 1 start, 1 parity
int delay = SECOND / cps;
int noisybits = 0;
@ -65,9 +62,9 @@ main(int argc, char *argv[]) {
while ((c = getchar()) != EOF) {
usleep(delay);
for (int bit = 0; bit < 8; bit++) {
int r = rand() % NOISINESS_DENOMINATOR;
int r = random() % NOISINESS_DENOMINATOR;
if (r < noisiness) {
noisybits = rand() % noiselen;
noisybits = random() % noiselen;
}
if (noisybits) {