blob: a01a5a7cbfb7b039496c684444887584639d6972 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "net/third_party/quiche/src/quic/test_tools/mock_random.h"
6
7#include <string.h>
8
9namespace quic {
10namespace test {
11
12MockRandom::MockRandom() : base_(0xDEADBEEF), increment_(0) {}
13
14MockRandom::MockRandom(uint32_t base) : base_(base), increment_(0) {}
15
16void MockRandom::RandBytes(void* data, size_t len) {
17 memset(data, increment_ + static_cast<uint8_t>('r'), len);
18}
19
20uint64_t MockRandom::RandUint64() {
21 return base_ + increment_;
22}
23
24void MockRandom::ChangeValue() {
25 increment_++;
26}
27
28} // namespace test
29} // namespace quic