| Index: src/platform-linux.cc
|
| ===================================================================
|
| --- src/platform-linux.cc (revision 244)
|
| +++ src/platform-linux.cc (working copy)
|
| @@ -67,7 +67,12 @@
|
|
|
| void OS::Setup() {
|
| // Seed the random number generator.
|
| - srandom(static_cast<unsigned int>(TimeCurrentMillis()));
|
| + // Convert the current time to a 64-bit integer first, before converting it
|
| + // 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());
|
| + srandom(static_cast<unsigned int>(seed));
|
| }
|
|
|
|
|
|
|