diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-04 01:41:26 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-04 01:41:26 +0800 |
commit | 920cb52f211a03479556866c712298141d368c50 (patch) | |
tree | 968cf0db6a62db237b6d928c42e40631a231b792 /util | |
parent | 87fb00ac1f12f18d1176a4dc1988c8b86a7ef63c (diff) | |
download | pttbbs-920cb52f211a03479556866c712298141d368c50.tar pttbbs-920cb52f211a03479556866c712298141d368c50.tar.gz pttbbs-920cb52f211a03479556866c712298141d368c50.tar.bz2 pttbbs-920cb52f211a03479556866c712298141d368c50.tar.lz pttbbs-920cb52f211a03479556866c712298141d368c50.tar.xz pttbbs-920cb52f211a03479556866c712298141d368c50.tar.zst pttbbs-920cb52f211a03479556866c712298141d368c50.zip |
replace rand() with random() for better randomness
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2460 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r-- | util/openvice.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util/openvice.c b/util/openvice.c index bf258a3f..588fc41d 100644 --- a/util/openvice.c +++ b/util/openvice.c @@ -20,14 +20,14 @@ int main(int argc, char **argv) // XXX: resolve_utmp(); attach_SHM(); - srand(SHM->number); + srandom(SHM->number); /* FIXME 小站的 SHM->number 變化不大, 可能導致開獎號碼固定 */ if (!fp || !fb ) perror("error open file"); - bingo = rand() % MAX_BINGO; + bingo = random() % MAX_BINGO; fprintf(fp, "%1c[1;33m統一發票中獎號碼[m\n", ' '); fprintf(fp, "%1c[1;37m================[m\n", ' '); fprintf(fp, "%1c[1;31m特別獎[m: [1;31m%08d[m\n\n", ' ', bingo); @@ -35,7 +35,7 @@ int main(int argc, char **argv) while (i < 5) { - bingo = (base + rand()) % MAX_BINGO; + bingo = (base + random()) % MAX_BINGO; fprintf(fp, "%1c[1;36m第%s獎[m: [1;37m%08d[m\n", ' ', TABLE[i], bingo); fprintf(fb, "%08d\n", bingo); i++; |