[go: nahoru, domu]

Fix ClangTidy warnings to use random_.Uniform().

This CL lands server changes 158719652, 158871672, and 158884213 by
clshepherd.

BUG=488484

Review-Url: https://codereview.chromium.org/2944673002
Cr-Commit-Position: refs/heads/master@{#480429}
diff --git a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
index 6c7fcc5..fad3c8d 100644
--- a/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
+++ b/net/http2/decoder/payload_decoders/payload_decoder_base_test_util.h
@@ -431,7 +431,7 @@
       fb.AppendZeroes(pad_length());
       VLOG(1) << "fb.size=" << fb.size();
       // Pick a random length for the payload that is shorter than neccesary.
-      payload_length = Random().Rand32() % fb.size();
+      payload_length = Random().Uniform(fb.size());
     }
 
     VLOG(1) << "payload_length=" << payload_length;
diff --git a/net/http2/hpack/decoder/hpack_varint_decoder_test.cc b/net/http2/hpack/decoder/hpack_varint_decoder_test.cc
index 7cdc872..088697d7 100644
--- a/net/http2/hpack/decoder/hpack_varint_decoder_test.cc
+++ b/net/http2/hpack/decoder/hpack_varint_decoder_test.cc
@@ -36,7 +36,6 @@
 namespace {
 
 class HpackVarintDecoderTest : public RandomDecoderTest {
-
  protected:
   DecodeStatus StartDecoding(DecodeBuffer* b) override {
     CHECK_LT(0u, b->Remaining());
@@ -221,7 +220,7 @@
       // values that require exactly |expected_bytes| extension bytes.
       values.insert({start, start + 1, beyond - 2, beyond - 1});
       while (values.size() < 100) {
-        values.insert(start + Random().Rand32() % range);
+        values.insert(start + Random().Uniform(range));
       }
     }
 
diff --git a/net/spdy/core/hpack/hpack_decoder3_test.cc b/net/spdy/core/hpack/hpack_decoder3_test.cc
index 223098caa..a1ff3d71 100644
--- a/net/spdy/core/hpack/hpack_decoder3_test.cc
+++ b/net/spdy/core/hpack/hpack_decoder3_test.cc
@@ -137,7 +137,7 @@
         // Decode some fragment of the remaining bytes.
         size_t bytes = str.length();
         if (!str.empty()) {
-          bytes = (random_.Rand8() % str.length()) + 1;
+          bytes = random_.Uniform(str.length()) + 1;
         }
         EXPECT_LE(bytes, str.length());
         if (!HandleControlFrameHeadersData(str.substr(0, bytes))) {