mathx

package
v0.0.0-...-fab4c1e Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package mathx provides extensions and utilities to the math package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Max

func Max[T constraints.Ordered](list ...T) T

Max returns the largest element in the list. If empty, returns the default value. Convenience function.

func MaxT

func MaxT[T any](cmp lang.CompareFn[T], list ...T) T

MaxT returns the largest element in the list, using the given ordering. If empty, returns the default value of T.

func Min

func Min[T constraints.Ordered](list ...T) T

Min returns the smallest element in the list. If empty, returns the default value. Convenience function.

func MinT

func MinT[T any](cmp lang.CompareFn[T], list ...T) T

MinT returns the smallest element in the list, using the given ordering. If empty, returns the default value of T.

func Numbers

func Numbers[T constraints.Integer](from T) lang.Iterator[T]

Numbers is an infinite number generator, returning from, from+1, from+2, ...

func Shuffle

func Shuffle[T any](list []T)

Shuffle randomly shuffles a list. Convenience function.

Types

This section is empty.

Jump to

Keyboard shortcuts

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