• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

oga's tools


Commit MetaInfo

Revision48d55cbdb48f78f255e09d3e4a1113623b9a584b (tree)
Zeit2014-01-01 05:52:30
Autoroga <oga@mxg....>
Commiteroga

Log Message

2014/01/01 fix win prob.

Ändern Zusammenfassung

Diff

--- a/rand2.c
+++ b/rand2.c
@@ -2,6 +2,7 @@
22 * rand : ランダムテスト
33 *
44 * 2006/05/14 V0.10 by oga.
5+ * 2014/01:01 V0.11 fix win prob.
56 */
67
78 #ifdef _WIN32
@@ -45,8 +46,9 @@ int main(int a, char *b[])
4546 }
4647
4748 #ifndef _WIN32
48- /* Windowsではいまいち */
49+ /* Windowsではイマイチ */
4950 tt = time(0);
51+
5052 #else /* _WIN32 */
5153 GetLocalTime(&syst);
5254 tt = syst.wHour * 3600 * 1000 +
@@ -54,9 +56,18 @@ int main(int a, char *b[])
5456 syst.wSecond * 1000 +
5557 syst.wMilliseconds;
5658 #endif /* _WIN32 */
59+
5760 srand(tt);
5861
59- printf("tt:%d RAND(%d):%d\n", tt, max, RAND(max));
62+ if (sizeof(time_t) == sizeof(int)) {
63+ printf("tt:%d RAND(%d):%d\n", tt, max, RAND(max));
64+ } else {
65+#ifdef _WIN32
66+ printf("tt:%I64u RAND(%d):%d\n", tt, max, RAND(max));
67+#else
68+ printf("tt:%llu RAND(%d):%d\n", tt, max, RAND(max));
69+#endif
70+ }
6071
6172 return 0;
6273 }