chromium/components/variations/service/limited_entropy_randomization.cc

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

#include "components/variations/service/limited_entropy_randomization.h"

#include <math.h>

#include <cstdint>
#include <limits>

#include "base/check_op.h"
#include "base/metrics/histogram_functions.h"
#include "base/numerics/checked_math.h"
#include "base/numerics/safe_conversions.h"
#include "components/variations/variations_layers.h"
#include "components/variations/variations_seed_processor.h"

namespace variations {

namespace {

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class SeedRejectionReason {};

// Converts a probability value (represented by numerator/denominator) to an
// entropy value. Callers should ensure that both arguments are strictly
// positive and that `numerator` <= `denominator`. This always returns a
// non-negative number.
double ConvertToBitsOfEntropy(uint64_t numerator, uint64_t denominator) {}

void LogSeedRejectionReason(SeedRejectionReason reason) {}

// Returns the number of bits of entropy used by a single study.
double GetEntropyUsedByStudy(const Study& study) {}

// Returns the maximal amount of entropy (in bits) used across all studies
// constrained to the given limited layer. This function requires the following
// conditions to be met:
// - The total number of slots in `limited_layer` is larger than 0.
// - For each `SlotRange`, range end is larger than or equal to range start.
// - The sum of the ranges (`num_slots_in_member` below) cannot exceed the
//   number of slots in the layer.
double GetEntropyUsedByLimitedLayer(const Layer& limited_layer,
                                    const VariationsSeed& seed) {}

}  // namespace

bool SeedHasMisconfiguredEntropy(const VariationsLayers& layers,
                                 const VariationsSeed& seed) {}

double GetEntropyUsedByLimitedLayerForTesting(const Layer& limited_layer,
                                              const VariationsSeed& seed) {}

}  // namespace variations