package util import ( "math/rand" "strings" "time" ) const alphabet = "abcdefghijklmnopqrstuvwxyz" func init() { rand.Seed(time.Now().UnixNano()) } // RandomInt generates a random integer between min and max func RandomInt(min, max int64) int64 { return min + rand.Int63n(max-min+1) } func RandomFloat(max, div float64) float64 { return (rand.Float64() * max) * div } // RandomString generates a random string of length n func RandomString(n int) string { var sb strings.Builder k := len(alphabet) for i := 0; i < n; i++ { c := alphabet[rand.Intn(k)] sb.WriteByte(c) } return sb.String() }