chromium/base/rand_util.cc

// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/rand_util.h"

#include <limits.h>
#include <math.h>
#include <stdint.h>

#include <algorithm>
#include <atomic>
#include <limits>

#include "base/check_op.h"
#include "base/time/time.h"

namespace base {

namespace {

// A MetricSubsampler instance is not thread-safe. However, the global
// sampling state may be read concurrently with writing it via testing
// scopers, hence the need to use atomics. All operations use
// memory_order_relaxed because there are no dependent memory accesses.
std::atomic<bool> g_subsampling_always_sample =;
std::atomic<bool> g_subsampling_never_sample =;

}  // namespace

uint64_t RandUint64() {}

int RandInt(int min, int max) {}

double RandDouble() {}

float RandFloat() {}

TimeDelta RandTimeDelta(TimeDelta start, TimeDelta limit) {}

TimeDelta RandTimeDeltaUpTo(TimeDelta limit) {}

double BitsToOpenEndedUnitInterval(uint64_t bits) {}

float BitsToOpenEndedUnitIntervalF(uint64_t bits) {}

uint64_t RandGenerator(uint64_t range) {}

std::string RandBytesAsString(size_t length) {}

std::vector<uint8_t> RandBytesAsVector(size_t length) {}

InsecureRandomGenerator::InsecureRandomGenerator() {}

void InsecureRandomGenerator::ReseedForTesting(uint64_t seed) {}

uint64_t InsecureRandomGenerator::RandUint64() {}

uint32_t InsecureRandomGenerator::RandUint32() {}

double InsecureRandomGenerator::RandDouble() {}

MetricsSubSampler::MetricsSubSampler() = default;
bool MetricsSubSampler::ShouldSample(double probability) {}

MetricsSubSampler::ScopedAlwaysSampleForTesting::
    ScopedAlwaysSampleForTesting() {}

MetricsSubSampler::ScopedAlwaysSampleForTesting::
    ~ScopedAlwaysSampleForTesting() {}

MetricsSubSampler::ScopedNeverSampleForTesting::ScopedNeverSampleForTesting() {}

MetricsSubSampler::ScopedNeverSampleForTesting::~ScopedNeverSampleForTesting() {}

}  // namespace base