Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Unified Diff: Source/wtf/RandomNumber.cpp

Issue 14178012: Remove the USE(OS_RANDOMNESS) guard. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/RandomNumber.h ('k') | Source/wtf/RandomNumberSeed.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/RandomNumber.cpp
diff --git a/Source/wtf/RandomNumber.cpp b/Source/wtf/RandomNumber.cpp
index c0974f7350b490b65d93a37387a700a5f367b56e..7c764d3fcdc6d9044740545a45b32e7c222348f2 100644
--- a/Source/wtf/RandomNumber.cpp
+++ b/Source/wtf/RandomNumber.cpp
@@ -38,39 +38,9 @@
namespace WTF {
-#if !USE(OS_RANDOMNESS)
-namespace Internal {
-
-static uint64_t state;
-
-void initializeRandomNumber(uint64_t seed)
-{
- state = seed;
-}
-
-// This random number generator comes from: Klimov, A. and Shamir, A.,
-// "A New Class of Invertible Mappings", Cryptographic Hardware and Embedded
-// Systems 2002, http://dl.acm.org/citation.cfm?id=752741
-//
-// Very fast, very simple, and passes Diehard and other good statistical
-// tests as strongly as cryptographically-secure random number generators (but
-// is not itself cryptographically-secure).
-uint32_t randomNumber()
-{
- state += (state * state) | 5;
- return static_cast<uint32_t>(state >> 32);
-}
-
-}
-#endif
-
double randomNumber()
{
-#if USE(OS_RANDOMNESS)
uint32_t bits = cryptographicallyRandomNumber();
-#else
- uint32_t bits = Internal::randomNumber();
-#endif
return static_cast<double>(bits) / (static_cast<double>(std::numeric_limits<uint32_t>::max()) + 1.0);
}
« no previous file with comments | « Source/wtf/RandomNumber.h ('k') | Source/wtf/RandomNumberSeed.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698