diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-06 00:52:39 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-06 00:52:39 +0000 |
commit | 5557b198f9815a758cf5a27d463e077b8bbbbfd8 (patch) | |
tree | 72d192231b743092b69ba1cbb5bb4501aa324e41 /base/rand_util.cc | |
parent | dc86fccde35745d2b1501fcc08d9aa42ea1ee1cc (diff) | |
download | chromium_src-5557b198f9815a758cf5a27d463e077b8bbbbfd8.zip chromium_src-5557b198f9815a758cf5a27d463e077b8bbbbfd8.tar.gz chromium_src-5557b198f9815a758cf5a27d463e077b8bbbbfd8.tar.bz2 |
Revert 84197 - Add one-time randomization support for FieldTrial, and the ability to
disable field trials. I am going to have a need for both soon.
Cleaning up some comments about empty trial names, adding static
method TrialExists() and simplifying many call sites by using this
method.
While I'm in there and needing base/OWNERS approval, add an OWNERS
file for base/metrics that adds jar@chromium.org as an owner for that
directory.
BUG=none
TEST=base_unittests
TBR=jam@chromium.org
R=jar@chromium.org,phajdan.jr@chromium.org,mark@chromium.org,wtc@chromium.org
Reason for revert: See http://crbug.com/81750
BUG=81750
TBR=joi@chromium.org
Review URL: http://codereview.chromium.org/6931048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/rand_util.cc')
-rw-r--r-- | base/rand_util.cc | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/base/rand_util.cc b/base/rand_util.cc index 4140e9a..fc41ce8 100644 --- a/base/rand_util.cc +++ b/base/rand_util.cc @@ -25,10 +25,6 @@ int RandInt(int min, int max) { } double RandDouble() { - return BitsToOpenEndedUnitInterval(base::RandUint64()); -} - -double BitsToOpenEndedUnitInterval(uint64 bits) { // We try to get maximum precision by masking out as many bits as will fit // in the target type's mantissa, and raising it to an appropriate power to // produce output in the range [0, 1). For IEEE 754 doubles, the mantissa @@ -36,7 +32,7 @@ double BitsToOpenEndedUnitInterval(uint64 bits) { COMPILE_ASSERT(std::numeric_limits<double>::radix == 2, otherwise_use_scalbn); static const int kBits = std::numeric_limits<double>::digits; - uint64 random_bits = bits & ((GG_UINT64_C(1) << kBits) - 1); + uint64 random_bits = base::RandUint64() & ((GG_UINT64_C(1) << kBits) - 1); double result = ldexp(static_cast<double>(random_bits), -1 * kBits); DCHECK_GE(result, 0.0); DCHECK_LT(result, 1.0); |