Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BytesFlag ¶
type BytesFlag struct {
// contains filtered or unexported fields
}
BytesFlag provides a command line flag interface for specifying random bytes. The specification provides for both the length of the random bytes and a target compression ratio.
func NewBytesFlag ¶
NewBytesFlag creates a new BytesFlag initialized with the specified spec.
func (*BytesFlag) Bytes ¶
Bytes returns random bytes. The length of the random bytes comes from the internal sizeFlag.
type Deck ¶
type Deck struct {
// contains filtered or unexported fields
}
Deck is a random number generator that generates numbers in the range [0,len(weights)-1] where the probability of i is weights(i)/sum(weights). Unlike Weighted, the weights are specified as integers and used in a deck-of-cards style random number selection which ensures that each element is returned with a desired frequency within the size of the deck.
type Dynamic ¶
type Dynamic interface {
Static
// Increment the max value the variable will return.
IncMax(delta uint64)
// Read the current max value the variable will return.
Max() uint64
}
Dynamic models a random variable that pulls from a distribution with an upper bound that can change dynamically using the IncMax method.
type Flag ¶
type Flag struct {
Static
// contains filtered or unexported fields
}
Flag provides a command line flag interface for specifying static random variables.
type SkewedLatest ¶
type SkewedLatest struct {
// contains filtered or unexported fields
}
SkewedLatest is a random number generator that generates numbers in the range [min, max], but skews it towards max using a zipfian distribution.
func NewDefaultSkewedLatest ¶
func NewDefaultSkewedLatest() (*SkewedLatest, error)
NewDefaultSkewedLatest constructs a new SkewedLatest generator with the default parameters.
func NewSkewedLatest ¶
func NewSkewedLatest(min, max uint64, theta float64) (*SkewedLatest, error)
NewSkewedLatest constructs a new SkewedLatest generator with the given parameters. It returns an error if the parameters are outside the accepted range.
func (*SkewedLatest) Uint64 ¶
func (z *SkewedLatest) Uint64(rng *rand.Rand) uint64
Uint64 returns a random Uint64 between min and max, where keys near max are most likely to be drawn.
type Static ¶
type Static interface {
Uint64(rng *rand.Rand) uint64
}
Static models a random variable that pulls from a distribution with static bounds
type Uniform ¶
type Uniform struct {
// contains filtered or unexported fields
}
Uniform is a random number generator that generates draws from a uniform distribution.
func NewUniform ¶
NewUniform constructs a new Uniform generator with the given parameters. Returns an error if the parameters are outside the accepted range.
type Weighted ¶
type Weighted struct {
// contains filtered or unexported fields
}
Weighted is a random number generator that generates numbers in the range [0,len(weights)-1] where the probability of i is weights(i)/sum(weights).
func NewWeighted ¶
NewWeighted returns a new weighted random number generator.
type Zipf ¶
type Zipf struct {
// contains filtered or unexported fields
}
Zipf is a random number generator that generates random numbers from a Zipf distribution. Unlike rand.Zipf, this generator supports incrementing the max parameter without performing an expensive recomputation of the underlying hidden parameters, which is a pattern used in [1] for efficiently generating large volumes of Zipf-distributed records for synthetic data. Second, rand.Zipf only supports theta <= 1, we suppose all values of theta.
func NewDefaultZipf ¶
NewDefaultZipf constructs a new Zipf generator with the default parameters.
func NewZipf ¶
NewZipf constructs a new Zipf generator with the given parameters. Returns an error if the parameters are outside the accepted range.