mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-10-01 07:23:55 +00:00
Add api build and clean to makefile (files restructure) (#9)
* no message * add clean api command
This commit is contained in:
22
api/pkg/utils/randomString.go
Normal file
22
api/pkg/utils/randomString.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
const charset = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
|
||||
var seededRand = rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
|
||||
func StringWithCharset(length int, charset string) string {
|
||||
b := make([]byte, length)
|
||||
for i := range b {
|
||||
b[i] = charset[seededRand.Intn(len(charset))]
|
||||
}
|
||||
return string(b)
|
||||
}
|
||||
|
||||
func GetRandomString(length int) string {
|
||||
return StringWithCharset(length, charset)
|
||||
}
|
Reference in New Issue
Block a user