Replace usage of Random
authorStephen Toub <stoub@microsoft.com>
Thu, 2 Feb 2017 18:05:13 +0000 (13:05 -0500)
committerStephen Toub <stoub@microsoft.com>
Fri, 3 Feb 2017 14:25:11 +0000 (09:25 -0500)
commit65c3fa5642916cc6d2b1a165f56af56e56d137a5
treed92e534eae661d5e8a9e7dd4584fbd60f8632a06
parent678e2993b632506090871eceebda8a9a7e6e716f
Replace usage of Random

We need some randomness, but it doesn't need to be particularly good, just fast.  A simple xorshift prng is 3-4x faster than Random, in particular without multiple virtual method calls that don't get inlined.  It's also a bit lighter in terms of memory (though there's only one of these per thread, so it doesn't impact much).

Commit migrated from https://github.com/dotnet/coreclr/commit/c06dc0048f935c8de4f35972b0c70f970b7b254c
src/coreclr/src/mscorlib/src/System/Threading/ThreadPool.cs