folly: randomNumberSeed should be random wrt multiple threads
authorSergey Doroshenko <sdoroshenko@fb.com>
Tue, 14 Aug 2012 19:54:49 +0000 (12:54 -0700)
committerTudor Bosman <tudorb@fb.com>
Sun, 26 Aug 2012 18:13:17 +0000 (11:13 -0700)
commit68a546c7cdd7df99b436a0d26c2ef7bb766fe435
treebc54e360d3c3cdb9a4ce28a7188af3e6c907d457
parentf3f96c69481d5dd078e3563b13bf05903dba6517
folly: randomNumberSeed should be random wrt multiple threads

Summary:
Right now, it relies on process id rather than on thread id. Thus, it can
return the same seed when called from multiple threads over really short
period of time, and these unlucky threads will end up with identical "random"
sequences.

Test Plan: newly added test fails against trunk, passes against changes in the diff

Reviewed By: tudorb@fb.com

FB internal diff: D548129
folly/Random.cpp
folly/test/RandomTest.cpp [new file with mode: 0644]