number

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(number, lower, upper interface{}) (interface{}, error)

Clamp a given number to be within the specified range [lower, upper]. The function accepts three arguments: number, lower bound (lower), and upper bound (upper), all of type interface{}. It returns the clamped value within the specified range and an error if any issue occurs.

func InRange

func InRange(number, start interface{}, end ...interface{}) (bool, error)

InRange checks if a given number is within the specified range [start, end). The function accepts three arguments: number, start, and end, all of type interface{}. It returns a boolean indicating whether the number is within the range and an error if any issue occurs.

func Random

func Random(upper float64, lower ...float64) float64

Random generates a Random float64 number within the specified range. The function accepts an upper bound (upper) and an optional lower bound (lower). It returns a Random float64 number between lower (inclusive) and upper (exclusive).

Types

This section is empty.

Jump to

Keyboard shortcuts

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