17 lines
348 B
Go
17 lines
348 B
Go
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)
|
|
}
|