diff options
author | David E. O'Brien <obrien@FreeBSD.org> | 2001-04-30 17:44:40 +0000 |
---|---|---|
committer | David E. O'Brien <obrien@FreeBSD.org> | 2001-04-30 17:44:40 +0000 |
commit | 68af4f7b3090d20c814f69ee738ed70773504560 (patch) | |
tree | f1ed52403a75142cf126cb3923a436088d69a0ad /lang/nawk | |
parent | Default to -O, not -O2. (diff) |
Use [s]random() rather than [s]rand().
Submitted by: kris
Notes
Notes:
svn path=/head/; revision=42093
Diffstat (limited to 'lang/nawk')
-rw-r--r-- | lang/nawk/files/patch-run.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lang/nawk/files/patch-run.c b/lang/nawk/files/patch-run.c new file mode 100644 index 000000000000..430c350e847d --- /dev/null +++ b/lang/nawk/files/patch-run.c @@ -0,0 +1,21 @@ +--- run.c.orig Mon Oct 30 13:26:57 2000 ++++ run.c Mon Apr 30 00:00:26 2001 +@@ -1483,15 +1483,15 @@ + u = (Awkfloat) system(getsval(x)) / 256; /* 256 is unix-dep */ + break; + case FRAND: +- /* in principle, rand() returns something in 0..RAND_MAX */ +- u = (Awkfloat) (rand() % RAND_MAX) / RAND_MAX; ++ /* in principle, random() returns something in 0..RAND_MAX */ ++ u = (Awkfloat) (random() % RAND_MAX) / RAND_MAX; + break; + case FSRAND: + if (isrec(x)) /* no argument provided */ + u = time((time_t *)0); + else + u = getfval(x); +- srand((unsigned int) u); ++ srandom((unsigned int) u); + break; + case FTOUPPER: + case FTOLOWER: |