mathx

package
v0.1.73 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetExpDistributedInt added in v0.1.68

func GetExpDistributedInt(rate float64) int

GetExpDistributedInt returns a exponentially distributed number in the interval [0, +math.MaxFloat64), rounded to the nearest int. Callers can adjust the rate of the function through the rate parameter. NOTE: this function uses the default Source from the math/rand package. This source is only seeded with a random value since go 1.20.

func GetHaversineDistance

func GetHaversineDistance(lat1, lon1, lat2, lon2 float64) float64

GetHaversineDistance finds the distance (in km) between two latitude/longitude pairs using the Haversine formula. For more details, see http://en.wikipedia.org/wiki/Haversine_formula.

func GetRandomInt added in v0.1.68

func GetRandomInt(max int) int

GetRandomInt returns a non-negative pseudo-random number in the interval [0, max). It returns 0 if max <= 0. NOTE: this function uses the default Source from the math/rand package. This source is only seeded with a random value since go 1.20.

func Min

func Min(a, b int) int

Min returns the minimum of two ints.

func Mode added in v0.1.73

func Mode(slice []int64) (int64, error)

Mode returns the mode of a slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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