summary refs log tree commit diff stats
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/cetus/random.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/cetus/random.go b/pkg/cetus/random.go
new file mode 100644
index 0000000..d77a24b
--- /dev/null
+++ b/pkg/cetus/random.go
@@ -0,0 +1,16 @@
+package cetus
+
+import (
+	"math/rand"
+)
+
+// RandAlNum returns random alpha-numeric string of specific length
+func RandAlNum(n int) string {
+	rand.Seed(time.Now().UnixNano())
+	const alphanum = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+	b := make([]byte, n)
+	for i := range b {
+		b[i] = letterBytes[rand.Intn(len(letterBytes))]
+	}
+	return string(b)
+}