util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadAllStaminaDatasets

func DownloadAllStaminaDatasets(directory string)

DownloadAllStaminaDatasets downloads all of the stamina datasets to a given directory.

func Factorial

func Factorial(n int) int

Factorial returns the factorial of n by recursively calling itself.

func FileExists

func FileExists(filePath string) bool

FileExists checks if a given.

func Max

func Max(x, y int) int

Max returns the larger of x or y.

func MaxSlice

func MaxSlice(slice []int) int

MaxSlice returns the largest value within a slice.

func Min

func Min(x, y int) int

Min returns the smallest of x or y.

func RandomGeometricProbability

func RandomGeometricProbability(mean float64) int

RandomGeometricProbability returns a random geometrically distributed integer using a mean value.

func SumMap

func SumMap(currentMap map[int]int, key bool) int

SumMap returns the summed values within a map.

func SumSlice

func SumSlice(slice []int) int

SumSlice returns the summed values within a slice.

Types

type StatsTracker

type StatsTracker struct {
	// contains filtered or unexported fields
}

StatsTracker struct is used to keep track of minimum, maximum, average, variance and standard deviation values given a sequence of values. Mean and variance calculation is done using Welford's online algorithm.

func NewStatsTracker

func NewStatsTracker() StatsTracker

NewStatsTracker returns an empty StatsTracker struct.

func (*StatsTracker) Add

func (statsTracker *StatsTracker) Add(value float64)

Add adds a float value to the StatsTracker struct.

func (*StatsTracker) AddInt

func (statsTracker *StatsTracker) AddInt(intValue int)

AddInt adds an integer value to the StatsTracker struct.

func (StatsTracker) Max

func (statsTracker StatsTracker) Max() float64

Max returns the maximum value within the StatsTracker struct.

func (StatsTracker) Mean

func (statsTracker StatsTracker) Mean() float64

Mean returns the average value within the StatsTracker struct.

func (StatsTracker) Min

func (statsTracker StatsTracker) Min() float64

Min returns the minimum value within the StatsTracker struct.

func (StatsTracker) PopulationStandardDev

func (statsTracker StatsTracker) PopulationStandardDev() float64

PopulationStandardDev returns the population standard deviation value within the StatsTracker struct.

func (StatsTracker) PopulationVariance

func (statsTracker StatsTracker) PopulationVariance() float64

PopulationVariance returns the population variance value within the StatsTracker struct.

func (StatsTracker) SampleStandardDev

func (statsTracker StatsTracker) SampleStandardDev() float64

SampleStandardDev returns the sample standard deviation value within the StatsTracker struct.

func (StatsTracker) SampleVariance

func (statsTracker StatsTracker) SampleVariance() float64

SampleVariance returns the sample variance value within the StatsTracker struct.

type Void

type Void struct{}

Void struct represents an empty struct. Used to decrease memory overhead of maps.

var Null Void

Null variable of type Void. Used to decrease memory overhead of maps.

Jump to

Keyboard shortcuts

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