- add sources.
[platform/framework/web/crosswalk.git] / src / net / websockets / websocket_test_util.cc
1 // Copyright 2013 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/websockets/websocket_test_util.h"
6
7 #include "base/basictypes.h"
8
9 namespace net {
10
11 namespace {
12 const uint64 kA =
13     (static_cast<uint64>(0x5851f42d) << 32) + static_cast<uint64>(0x4c957f2d);
14 const uint64 kC = 12345;
15 const uint64 kM = static_cast<uint64>(1) << 48;
16
17 }  // namespace
18
19 LinearCongruentialGenerator::LinearCongruentialGenerator(uint32 seed)
20     : current_(seed) {}
21
22 uint32 LinearCongruentialGenerator::Generate() {
23   uint64 result = current_;
24   current_ = (current_ * kA + kC) % kM;
25   return static_cast<uint32>(result >> 16);
26 }
27
28 }  // namespace net