github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/internal/randvar/randvar.go (about)

     1  // Copyright 2019 The LevelDB-Go and Pebble Authors. All rights reserved. Use
     2  // of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  package randvar
     6  
     7  import "golang.org/x/exp/rand"
     8  
     9  // Static models a random variable that pulls from a distribution with static
    10  // bounds
    11  type Static interface {
    12  	Uint64(rng *rand.Rand) uint64
    13  }
    14  
    15  // Dynamic models a random variable that pulls from a distribution with an
    16  // upper bound that can change dynamically using the IncMax method.
    17  type Dynamic interface {
    18  	Static
    19  
    20  	// Increment the max value the variable will return.
    21  	IncMax(delta int)
    22  
    23  	// Read the current max value the variable will return.
    24  	Max() uint64
    25  }