math

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package math contains helpers for basic numeric calculations and probability-based utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChanceOf

func ChanceOf(probability float64) bool

ChanceOf returns true with the given probability (0.0 to 1.0). It uses crypto/rand to ensure a uniform distribution.

func FormatNumber

func FormatNumber(num *float64) string

FormatNumber converts a floating point number to a human friendly string. It removes trailing zeros and omits a decimal point for whole numbers. A nil pointer results in an empty string.

func Max

func Max(a, b int) int

Max returns the larger of the two provided integers.

func Min

func Min(a int, b int) int

Min returns the smaller of the two provided integers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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