summaryrefslogtreecommitdiffstats
path: root/base/rand_util.cc
diff options
context:
space:
mode:
authorkushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 01:29:38 +0000
committerkushi.p@gmail.com <kushi.p@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-04 01:29:38 +0000
commite1be56dcd226056bb8af7f82bc1752bb289aa14b (patch)
tree46e3bf1eaa6d8d8c7f5180261643040c51e03e45 /base/rand_util.cc
parent15a2084decf18de467200317261d2d6c8d5e631b (diff)
downloadchromium_src-e1be56dcd226056bb8af7f82bc1752bb289aa14b.zip
chromium_src-e1be56dcd226056bb8af7f82bc1752bb289aa14b.tar.gz
chromium_src-e1be56dcd226056bb8af7f82bc1752bb289aa14b.tar.bz2
Updating logging in src/base/. Using DCHECK_NE/EQ/LE/GE/GT() where possible
BUG=58409 Review URL: http://codereview.chromium.org/6883295 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/rand_util.cc')
-rw-r--r--base/rand_util.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/base/rand_util.cc b/base/rand_util.cc
index d89f8b7..a71bb0c 100644
--- a/base/rand_util.cc
+++ b/base/rand_util.cc
@@ -18,7 +18,8 @@ int RandInt(int min, int max) {
uint64 range = static_cast<uint64>(max) - min + 1;
int result = min + static_cast<int>(base::RandGenerator(range));
- DCHECK(result >= min && result <= max);
+ DCHECK_GE(result, min);
+ DCHECK_LE(result, max);
return result;
}
@@ -32,7 +33,8 @@ double RandDouble() {
static const int kBits = std::numeric_limits<double>::digits;
uint64 random_bits = base::RandUint64() & ((GG_UINT64_C(1) << kBits) - 1);
double result = ldexp(static_cast<double>(random_bits), -1 * kBits);
- DCHECK(result >= 0.0 && result < 1.0);
+ DCHECK_GE(result, 0.0);
+ DCHECK_LT(result, 1.0);
return result;
}