histogram

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2024 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Overview

Copyright (c) 2018-2024 Jean-Francois SMIGIELSKI Copyright (c) 2024 OVHCloud SAS

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ErrBadCSV = errors.New("bad CSV line")
View Source
var ErrBadSize = errors.New("negative size configured")
View Source
var ErrBadWeight = errors.New("negative weight configured")
View Source
var ErrEmpty = errors.New("no size configured")

Functions

This section is empty.

Types

type Int64Distribution added in v0.0.2

type Int64Distribution interface {
	// Produces a new int64 respecting the distribution and based on the given uniform PRNG
	Poll(r *rand.Rand) int64
}

func NewSizeHistograms

func NewSizeHistograms(sizes []Int64HistogramBar) (Int64Distribution, error)

NewSizeHistograms returns a Int64Distribution implementing histogram-like buckets, ready to use and based on a collection of size bars

func ParseCSV

func ParseCSV(csv string) (Int64Distribution, error)

ParseCSV returns a Int64Distribution implementing histogram-like buckets, ready to use and based on a collection of size bars described as a coma-separated sequence of "size:weight" values

func ParseTokens

func ParseTokens(pairs []string, separator string) (Int64Distribution, error)

ParseTokens returns a Int64Histogram ready to use, based on a collection of size bars stored in an array of "size <separator> weight" tokens

type Int64HistogramBar

type Int64HistogramBar struct {
	Size   int64 `yaml:"size"`
	Weight int64 `yaml:"weight"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL