Commit 64c682b1 authored by ager@chromium.org's avatar ager@chromium.org

Revert seeding the random number generator with rand_s on Windows. It

makes browser_tests fail.

TBR=jschuh@chromium.org
Review URL: http://codereview.chromium.org/5284006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5900 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 84f2f5ee
...@@ -54,11 +54,6 @@ ...@@ -54,11 +54,6 @@
#define _WIN32_WINNT 0x501 #define _WIN32_WINNT 0x501
#endif #endif
// Required before stdlib.h inclusion for cryptographically strong rand_s.
#ifndef _CRT_RAND_S
#define _CRT_RAND_S
#endif // _CRT_RAND_S
#include <windows.h> #include <windows.h>
#include <time.h> // For LocalOffset() implementation. #include <time.h> // For LocalOffset() implementation.
...@@ -589,8 +584,11 @@ char* Time::LocalTimezone() { ...@@ -589,8 +584,11 @@ char* Time::LocalTimezone() {
void OS::Setup() { void OS::Setup() {
// Seed the random number generator. // Seed the random number generator.
unsigned int seed; // Convert the current time to a 64-bit integer first, before converting it
CHECK_EQ(rand_s(&seed), 0); // to an unsigned. Going directly can cause an overflow and the seed to be
// set to all ones. The seed will be identical for different instances that
// call this setup code within the same millisecond.
uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis());
srand(static_cast<unsigned int>(seed)); srand(static_cast<unsigned int>(seed));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment