paste-abroad/internel/utils/utils.go

17 lines
348 B
Go
Raw Permalink Normal View History

package utils
import (
"math/rand"
)
var letters = []rune("abcdefghijklmnopqrstuvwxyz")
// GenearteId will create a string contains 8 lowercase alphabets
func GenerateId(length int) string {
buffer := make([]rune, length)
for i := range buffer {
buffer[i] = letters[rand.Intn(len(letters))]
}
return string(buffer)
}