#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "base/rand_util.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <memory>
#include <vector>
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
namespace {
const int kIntMin = …;
const int kIntMax = …;
}
TEST(RandUtilTest, RandInt) { … }
TEST(RandUtilTest, RandDouble) { … }
TEST(RandUtilTest, RandFloat) { … }
TEST(RandUtilTest, RandTimeDelta) { … }
TEST(RandUtilTest, RandTimeDeltaUpTo) { … }
TEST(RandUtilTest, BitsToOpenEndedUnitInterval) { … }
TEST(RandUtilTest, BitsToOpenEndedUnitIntervalF) { … }
TEST(RandUtilTest, RandBytes) { … }
TEST(RandUtilTest, RandBytes0) { … }
TEST(RandUtilTest, RandBytesAsVector) { … }
TEST(RandUtilTest, RandBytesAsString) { … }
TEST(RandUtilTest, RandGeneratorForRandomShuffle) { … }
TEST(RandUtilTest, RandGeneratorIsUniform) { … }
TEST(RandUtilTest, RandUint64ProducesBothValuesOfAllBits) { … }
TEST(RandUtilTest, RandBytesLonger) { … }
TEST(RandUtilTest, DISABLED_RandBytesPerf) { … }
TEST(RandUtilTest, InsecureRandomGeneratorProducesBothValuesOfAllBits) { … }
namespace {
constexpr double kXp1Percent = …;
constexpr double kXp99Percent = …;
double ChiSquaredCriticalValue(double nu, double x_p) { … }
int ExtractBits(uint64_t value, int from_bit, int num_bits) { … }
bool ChiSquaredTest(InsecureRandomGenerator& gen,
size_t n,
int from_bit,
int num_bits) { … }
}
TEST(RandUtilTest, InsecureRandomGeneratorChiSquared) { … }
TEST(RandUtilTest, InsecureRandomGeneratorRandDouble) { … }
TEST(RandUtilTest, MetricsSubSampler) { … }
TEST(RandUtilTest, MetricsSubSamplerTestingSupport) { … }
}