• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 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 #ifndef THIRD_PARTY_BASE_ALLOCATOR_PARTITION_ALLOCATOR_RANDOM_H_
6 #define THIRD_PARTY_BASE_ALLOCATOR_PARTITION_ALLOCATOR_RANDOM_H_
7 
8 #include <stdint.h>
9 
10 #include "third_party/base/base_export.h"
11 
12 namespace pdfium {
13 namespace base {
14 
15 // Returns a random value. The generator's internal state is initialized with
16 // `base::RandUint64` which is very unpredictable, but which is expensive due to
17 // the need to call into the kernel. Therefore this generator uses a fast,
18 // entirely user-space function after initialization.
19 BASE_EXPORT uint32_t RandomValue();
20 
21 // Sets the seed for the random number generator to a known value, to cause the
22 // RNG to generate a predictable sequence of outputs. May be called multiple
23 // times.
24 BASE_EXPORT void SetMmapSeedForTesting(uint64_t seed);
25 
26 }  // namespace base
27 }  // namespace pdfium
28 
29 #endif  // THIRD_PARTY_BASE_ALLOCATOR_PARTITION_ALLOCATOR_RANDOM_H_
30