Use better PRNG
This commit is contained in:
parent
c5739314d3
commit
f52b480d1a
7
baud.c
7
baud.c
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue