floatrange

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package floatrange provides distributions that accept and return float64s.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Infinite

type Infinite struct{}

Infinite is an immutable range that will always return math.MaxFloat64

func (Infinite) EnforceRange

func (i Infinite) EnforceRange(f float64) float64

EnforceRange returns math.MaxFloat64

func (Infinite) Mult

func (i Infinite) Mult(f float64) Range

Mult returns an infinite from an infinite.

func (Infinite) Percentile

func (i Infinite) Percentile(float64) float64

Percentile returns the float behind the constant

func (Infinite) Poll

func (i Infinite) Poll() float64

Poll returns MaxFloat64 on an infinite

type Range

type Range interface {
	Poll() float64
	Mult(f float64) Range
	EnforceRange(f float64) float64
	Percentile(f float64) float64
}

Range represents a range of floating point numbers

func NewConstant

func NewConstant(f float64) Range

NewConstant returns a range that will always poll to return f

func NewInfinite

func NewInfinite() Range

NewInfinite returns an infinite.

func NewLinear

func NewLinear(min, max float64) Range

NewLinear returns a linear range from min to max

func NewSpread

func NewSpread(base, spread float64) Range

NewSpread returns a linear range from base-spread to base+spread

Jump to

Keyboard shortcuts

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