Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / re2 / util / random.h
blob6c6e701ddf6fc5962411d5a38534ae447610a386
1 // Copyright 2005-2009 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Modified from Google perftools's tcmalloc_unittest.cc.
7 #ifndef RE2_UTIL_RANDOM_H__
8 #define RE2_UTIL_RANDOM_H__
10 #include "util/util.h"
12 namespace re2 {
14 // ACM minimal standard random number generator. (re-entrant.)
15 class ACMRandom {
16 public:
17 ACMRandom(int32 seed) : seed_(seed) {}
18 int32 Next();
19 int32 Uniform(int32);
21 void Reset(int32 seed) { seed_ = seed; }
23 private:
24 int32 seed_;
27 } // namespace re2
29 #endif // RE2_UTIL_RANDOM_H__