mathHelpers

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

README

mathHelpers

mathHelpers provides small numeric helper functions — random numbers, min/max, and coin toss.

Functions

Function Description
RandomInt(max int) int Returns a random int in [0, max)
RandomBetween(min, max int) int Returns a random int in [min, max)
CoinToss() bool Returns a random boolean
Max(x, y int) int Returns the larger of two ints
Min(x, y int) int Returns the smaller of two ints

Example

import "github.com/mt1976/frantic-core/mathHelpers"

func main() {
    n := mathHelpers.RandomBetween(1, 100)
    fmt.Println("Random number:", n)
    fmt.Println("Coin toss:", mathHelpers.CoinToss())
    fmt.Println("Max:", mathHelpers.Max(10, 20))
}

Documentation

Overview

Package mathHelpers contains small numeric helpers and utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoinToss

func CoinToss() bool

func Max

func Max(x, y int) int

func Min

func Min(x, y int) int

Min returns the smaller of x or y. The Min function returns the minimum value between two integers.

func RandomBetween

func RandomBetween(min, max int) int

func RandomInt

func RandomInt(max int) int

Types

This section is empty.

Jump to

Keyboard shortcuts

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