package numbers
import "git.sr.ht/~shulhan/pakakeh.go/lib/numbers"
Package numbers provide miscellaneous functions for working with integer and float.
Index ¶
- func Float64Round(v float64, nprec int) float64
- func Int64CreateSeq(min, max int64) (seq []int64)
- func IntCreateSeq(min, max int) (seq []int)
- func IntPickRandPositive(maxVal int, dup bool, pickedListID, exsListID []int) (idx int)
Functions ¶
func Float64Round ¶
Float64Round will round `v` to `nprec` digit in fraction.
func Int64CreateSeq ¶
Int64CreateSeq will create and return sequence of integer from `min` to `max`.
E.g. if min is 0 and max is 5 then it will return `[0 1 2 3 4 5]`.
func IntCreateSeq ¶
IntCreateSeq will create and return sequence of integer from `min` to `max`.
E.g. if min is 0 and max is 5 then it will return `[0 1 2 3 4 5]`.
func IntPickRandPositive ¶
IntPickRandPositive return random integer value from 0 to maximum value `maxVal`.
The random value is checked with already picked index: `pickedListID`.
If `dup` is true, allow duplicate value in `pickedListID`, otherwise only single unique value allowed in `pickedListID`.
If excluding index `exsListID` is not empty, do not pick the integer value listed in there.
Source Files ¶
float64.go int.go int64.go numbers.go
- Version
- v0.60.0 (latest)
- Published
- Feb 1, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 9 hours ago –
Tools for package owners.