From: Steinar H. Gunderson Date: Sat, 17 Mar 2012 16:15:41 +0000 (+0100) Subject: Fix undefined behavior in the random generator. X-Git-Url: https://git.sesse.net/?p=wloh;a=commitdiff_plain;h=2d60f0d0b70fe99afcd7d3d9360aa7357aa18022 Fix undefined behavior in the random generator. --- diff --git a/mcwordfeud.cpp b/mcwordfeud.cpp index 7470af3..0010010 100644 --- a/mcwordfeud.cpp +++ b/mcwordfeud.cpp @@ -50,9 +50,9 @@ float draw_gaussian(float stddev) float draw_gaussian(float mu, float stddev) { static bool inited = false; - static long unsigned seed = 123456789; - int kn[128]; - float fn[128], wn[128]; + static long unsigned seed = time(NULL); + static int kn[128]; + static float fn[128], wn[128]; if (!inited) { r4_nor_setup(kn, fn, wn); inited = true;