Documentation ¶
Index ¶
- Variables
- func AbsInt64(x int64) uint64
- func Add[N Addable](a N, nums ...N) N
- func BinaryCount[N constraints.Unsigned](n N) int
- func Combination(a, s uint64) uint64
- func Factorial(a uint64) uint64
- func GCD(m, n uint64) uint64
- func LCM(m, n uint64) uint64
- func Less[N constraints.Ordered](a, b N) bool
- func MatchWildcard(pattern, str string) bool
- func MatchWildcardByte(pattern, str []byte) bool
- func Max[N cmp.Ordered](a, b N) N
- func Maximum[N constraints.Ordered](a N, nums ...N) N
- func Min[N cmp.Ordered](a, b N) N
- func Minimum[N cmp.Ordered](a N, nums ...N) N
- func Multiply[N Multiplicative](a N, nums ...N) N
- func Permutation(a, s uint64) uint64
- func RandBool(odds float64) bool
- func RandDistribute[T constraints.Integer](total T, count int, deviation T) []T
- func RandF[T constraints.Float](min, max T) T
- func RandI[T constraints.Integer](min, max T) T
- func RandInt(min int, max int) int
- func RandTrue(odds int, base int) bool
- func RuneMaxMatch(src, ma []rune) int
- func RuneSimilarity(src, ma []rune) float32
- func StringSimilarityRune(s, p string) float32
- type Addable
- type Fractional
- func (myt Fractional) Add(r Fractional) Fractional
- func (myt Fractional) Div(r Fractional) Fractional
- func (myt *Fractional) Lose()
- func (myt Fractional) Mul(r Fractional) Fractional
- func (myt Fractional) Repeating() string
- func (myt Fractional) String() string
- func (myt Fractional) Sub(r Fractional) Fractional
- func (myt Fractional) Value() float64
- type Multiplicative
Constants ¶
This section is empty.
Variables ¶
View Source
var IInfFractional = Fractional{-1, 0}
View Source
var UInfFractional = Fractional{1, 0}
View Source
var ZeroFractional = Fractional{0, 1}
Functions ¶
func Less ¶ added in v0.2.1
func Less[N constraints.Ordered](a, b N) bool
func MatchWildcard ¶ added in v0.2.3
*
- MatchWildcard: - parse if a string matches given wildcard pattern
- @pattern: wildcard pattern
- @str: the string to be parsed *
- Description: Parse the string @str to check if matches wildcard
- pattern @pattern. The pattern may contain two type wildcardes:
- '*' - matches zero or more characters
- '?' - matches one character
- If it's matched, return true, else return false.
func MatchWildcardByte ¶ added in v0.2.3
func Maximum ¶ added in v0.2.0
func Maximum[N constraints.Ordered](a N, nums ...N) N
func RandDistribute ¶ added in v0.2.5
func RandDistribute[T constraints.Integer](total T, count int, deviation T) []T
func RuneMaxMatch ¶ added in v0.2.2
func RuneSimilarity ¶ added in v0.2.2
func StringSimilarityRune ¶ added in v0.2.2
Types ¶
type Addable ¶ added in v0.2.0
type Addable interface { cmp.Ordered | constraints.Complex }
can + +=
type Fractional ¶
func Float2Fractional ¶ added in v0.2.1
func Float2Fractional(f float64) (Fractional, error)
func MakeFractional ¶
func MakeFractional(numerator int64, denominator uint64) Fractional
func Str2Fractional ¶ added in v0.2.1
func Str2Fractional(s string) (Fractional, error)
func (Fractional) Add ¶
func (myt Fractional) Add(r Fractional) Fractional
func (Fractional) Div ¶
func (myt Fractional) Div(r Fractional) Fractional
func (*Fractional) Lose ¶
func (myt *Fractional) Lose()
func (Fractional) Mul ¶
func (myt Fractional) Mul(r Fractional) Fractional
func (Fractional) String ¶
func (myt Fractional) String() string
func (Fractional) Sub ¶
func (myt Fractional) Sub(r Fractional) Fractional
func (Fractional) Value ¶
func (myt Fractional) Value() float64
type Multiplicative ¶ added in v0.2.0
type Multiplicative interface { constraints.Integer | constraints.Float | constraints.Complex }
Click to show internal directories.
Click to hide internal directories.