Paperclip/pkg/internal/services/random_id.go

16 lines
294 B
Go

package services
import (
"math/rand"
)
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
func RandString(length int) string {
builder := make([]rune, length)
for i := range builder {
builder[i] = letters[rand.Intn(len(letters))]
}
return string(builder)
}