init repo

This commit is contained in:
liuyuanchuang
2025-12-10 18:33:37 +08:00
commit 48e63894eb
2408 changed files with 1053045 additions and 0 deletions

21
pkg/utils/arr.go Normal file
View File

@@ -0,0 +1,21 @@
package utils
import "math/rand"
func InArray[T comparable](needle T, haystack []T) bool {
for _, item := range haystack {
if item == needle {
return true
}
}
return false
}
func NewRandNumber(length int) (string, error) {
letters := []byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}
b := make([]byte, length)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b), nil
}