package main
import (
//"fmt"
"math/rand"
)
func randSeq(n int) string {
//letters := []rune("abcdefghijklmnopqrstuvwxyz")
letters := []rune("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
b := make([]rune, n)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b)
}
func main() {
for i := 1; i < 1000000; i++ {
//fmt.Println(randSeq(5))
randSeq(5)
}
}
http://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang
http://stackoverflow.com/questions/12771930/what-is-the-fastest-way-to-generate-a-long-random-string-in-go
标签:none