summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2013-06-06 11:39:51 +0000
committerAlain Frisch <alain@frisch.fr>2013-06-06 11:39:51 +0000
commit4ae200a6788a4125da63ecfbf793640f2d35319d (patch)
tree547198798e910205707a1e791e5d6c4d3c0eba11
parent997e739fd568bcf7a8221f4808056f80c046c5f9 (diff)
Commit Xavier's fix for #6032.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13750 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-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;
}