🏗️ move make sub-cmd to sub-dir
This commit is contained in:
13
pkg/tool/random/str.go
Normal file
13
pkg/tool/random/str.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package random
|
||||
|
||||
import "math/rand"
|
||||
|
||||
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
|
||||
func RandomString(length int) string {
|
||||
b := make([]byte, length)
|
||||
for i := range b {
|
||||
b[i] = charset[rand.Intn(len(charset))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
Reference in New Issue
Block a user