summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--byterun/win32.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/Changes b/Changes
index 018e72f04..698223322 100644
--- a/Changes
+++ b/Changes
@@ -130,6 +130,7 @@ Bug fixes:
- PR#6010: Big_int.extract_big_int gives wrong results on negative arguments
- PR#6024: Format syntax for printing @ is incompatible with 3.12.1
- PR#6001: Reduce the memory used by compiling Camlp4
+- PR#6032: better Random.self_init under Windows
Internals:
- Moved debugger/envaux.ml to typing/envaux.ml to publish env_of_only_summary
diff --git a/byterun/win32.c b/byterun/win32.c
index 2b4aacced..d807f6900 100644
--- a/byterun/win32.c
+++ b/byterun/win32.c
@@ -469,13 +469,18 @@ int caml_win32_random_seed (intnat data[16])
{
/* For better randomness, consider:
http://msdn.microsoft.com/library/en-us/seccrypto/security/rtlgenrandom.asp
+ http://blogs.msdn.com/b/michael_howard/archive/2005/01/14/353379.aspx
*/
FILETIME t;
+ LARGE_INTEGER pc;
GetSystemTimeAsFileTime(&t);
+ QueryPerformanceCounter(&pc); /* PR#6032 */
data[0] = t.dwLowDateTime;
data[1] = t.dwHighDateTime;
data[2] = GetCurrentProcessId();
- return 3;
+ data[3] = pc.LowPart;
+ data[4] = pc.HighPart;
+ return 5;
}