diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-03 20:58:42 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-03 20:58:42 +0800 |
commit | 2f79c54e2b80a89272edad8b9d128c843c8d132e (patch) | |
tree | 2388c3c21033fa0ccf2ba50302e83cacf22745ed /util/openticket.c | |
parent | ad8ffbe000a8bb31c72cf4422967623095e7a885 (diff) | |
download | pttbbs-2f79c54e2b80a89272edad8b9d128c843c8d132e.tar pttbbs-2f79c54e2b80a89272edad8b9d128c843c8d132e.tar.gz pttbbs-2f79c54e2b80a89272edad8b9d128c843c8d132e.tar.bz2 pttbbs-2f79c54e2b80a89272edad8b9d128c843c8d132e.tar.lz pttbbs-2f79c54e2b80a89272edad8b9d128c843c8d132e.tar.xz pttbbs-2f79c54e2b80a89272edad8b9d128c843c8d132e.tar.zst pttbbs-2f79c54e2b80a89272edad8b9d128c843c8d132e.zip |
comment on bad random number usage
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2456 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util/openticket.c')
-rw-r--r-- | util/openticket.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/util/openticket.c b/util/openticket.c index 10a431d9..b93439ab 100644 --- a/util/openticket.c +++ b/util/openticket.c @@ -80,17 +80,17 @@ int main(int argc, char **argv) */ bet=random() % 8; + /* 以上的說法及 code 並沒比 srand(time(0)) 好. 甚至更好預測. */ //XXX: resolve_utmp(); attach_SHM(); bet = SHM->UTMPnumber % 8; + /* FIXME 現在完全依 UTMPnumber 取值, 並沒用到 random function. + * 小站的 UTMPnumber 可視為定值... */ /* - * 在C中 srand 跟 srandom 一樣 rand 跟 random 一樣 - * 不同的是 rand 是傳回一個 double 給非整數的亂數用 - * random 是傳回一個 int 給整數的亂數用 * * 若要以rand inplement 整數的亂數 要注意以下 (man page中有) * |