grpc
third_party
abseil-cpp
absl
random
internal
abseil-cpp/absl/random/internal/sequence_urbg.h
Go to the documentation of this file.
1
// Copyright 2017 The Abseil Authors.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#ifndef ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_
16
#define ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_
17
18
#include <cstdint>
19
#include <cstring>
20
#include <limits>
21
#include <type_traits>
22
#include <vector>
23
24
#include "absl/base/config.h"
25
26
namespace
absl
{
27
ABSL_NAMESPACE_BEGIN
28
namespace
random_internal {
29
30
// `sequence_urbg` is a simple random number generator which meets the
31
// requirements of [rand.req.urbg], and is solely for testing absl
32
// distributions.
33
class
sequence_urbg
{
34
public
:
35
using
result_type
=
uint64_t
;
36
37
static
constexpr
result_type
(
min
)() {
38
return
(
std::numeric_limits<result_type>::min
)();
39
}
40
static
constexpr
result_type
(
max
)() {
41
return
(
std::numeric_limits<result_type>::max
)();
42
}
43
44
sequence_urbg
(std::initializer_list<result_type>
data
) :
i_
(0),
data_
(
data
) {}
45
void
reset
() {
i_
= 0; }
46
47
result_type
operator()
() {
return
data_
[
i_
++ %
data_
.size()]; }
48
49
size_t
invocations
()
const
{
return
i_
; }
50
51
private
:
52
size_t
i_
;
53
std::vector<result_type>
data_
;
54
};
55
56
}
// namespace random_internal
57
ABSL_NAMESPACE_END
58
}
// namespace absl
59
60
#endif // ABSL_RANDOM_INTERNAL_SEQUENCE_URBG_H_
absl::random_internal::sequence_urbg::sequence_urbg
sequence_urbg(std::initializer_list< result_type > data)
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:44
absl::random_internal::sequence_urbg::reset
void reset()
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:45
ABSL_NAMESPACE_END
#define ABSL_NAMESPACE_END
Definition:
third_party/abseil-cpp/absl/base/config.h:171
absl::random_internal::sequence_urbg
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:33
ABSL_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition:
third_party/abseil-cpp/absl/base/config.h:170
absl::random_internal::sequence_urbg::operator()
result_type operator()()
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:47
absl::random_internal::sequence_urbg::min
static constexpr result_type() min()
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:37
max
int max
Definition:
bloaty/third_party/zlib/examples/enough.c:170
uint64_t
unsigned __int64 uint64_t
Definition:
stdint-msvc2008.h:90
absl::random_internal::sequence_urbg::i_
size_t i_
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:52
absl::random_internal::sequence_urbg::max
static constexpr result_type() max()
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:40
data
char data[kBufferLength]
Definition:
abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
min
#define min(a, b)
Definition:
qsort.h:83
absl::random_internal::sequence_urbg::invocations
size_t invocations() const
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:49
absl::random_internal::sequence_urbg::data_
std::vector< result_type > data_
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:53
absl
Definition:
abseil-cpp/absl/algorithm/algorithm.h:31
absl::random_internal::sequence_urbg::result_type
uint64_t result_type
Definition:
abseil-cpp/absl/random/internal/sequence_urbg.h:35
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:10