Lines Matching refs:max
82 int RandomNumberGenerator::NextInt(int max) { in NextInt() argument
83 DCHECK_LT(0, max); in NextInt()
86 if (bits::IsPowerOfTwo(max)) { in NextInt()
87 return static_cast<int>((max * static_cast<int64_t>(Next(31))) >> 31); in NextInt()
92 int val = rnd % max; in NextInt()
93 if (rnd - val + (max - 1) >= 0) { in NextInt()
119 const std::unordered_set<uint64_t>& set, uint64_t max) { in ComplementSample() argument
121 result.reserve(max - set.size()); in ComplementSample()
122 for (uint64_t i = 0; i < max; i++) { in ComplementSample()
130 std::vector<uint64_t> RandomNumberGenerator::NextSample(uint64_t max, in NextSample() argument
132 CHECK_LE(n, max); in NextSample()
140 std::min(max - static_cast<uint64_t>(n), static_cast<uint64_t>(n))); in NextSample()
145 uint64_t x = static_cast<uint64_t>(NextDouble() * max); in NextSample()
146 CHECK_LT(x, max); in NextSample()
154 return ComplementSample(selected, max); in NextSample()
160 return NextSampleSlow(max, n, selected); in NextSample()
164 uint64_t max, size_t n, const std::unordered_set<uint64_t>& excluded) { in NextSampleSlow() argument
165 CHECK_GE(max - excluded.size(), n); in NextSampleSlow()
168 result.reserve(max - excluded.size()); in NextSampleSlow()
170 for (uint64_t i = 0; i < max; i++) { in NextSampleSlow()
179 std::max(max - static_cast<uint64_t>(n), static_cast<uint64_t>(n))); in NextSampleSlow()
193 std::unordered_set<uint64_t>(result.begin(), result.end()), max); in NextSampleSlow()