summaryrefslogtreecommitdiff
path: root/helpers/helpers.go
diff options
context:
space:
mode:
authorhuker667 <huker@tuta.io>2026-03-25 14:48:48 +0300
committerhuker667 <huker@tuta.io>2026-03-25 14:48:48 +0300
commite6aed353a2b288caa6c6a632a80d5484e4614b2c (patch)
tree878f8ed96951e22e8a1d02342c1e721ee13a5f70 /helpers/helpers.go
parent4ff821beed2565e84c9c8d0ac774fa678da1f10f (diff)
downloadqulay-e6aed353a2b288caa6c6a632a80d5484e4614b2c.tar.gz
qulay-e6aed353a2b288caa6c6a632a80d5484e4614b2c.tar.bz2
qulay-e6aed353a2b288caa6c6a632a80d5484e4614b2c.zip
move RandStr to helpers
Diffstat (limited to 'helpers/helpers.go')
-rw-r--r--helpers/helpers.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/helpers/helpers.go b/helpers/helpers.go
index ac92e6a..1db691b 100644
--- a/helpers/helpers.go
+++ b/helpers/helpers.go
@@ -3,9 +3,13 @@ package helpers
import (
"fmt"
"strings"
+ "math/rand"
+ "time"
"strconv"
)
+var r = rand.New(rand.NewSource(time.Now().UnixNano()))
+
func Ask(str string) bool {
var input string
fmt.Printf("-> %s (Y/n): ", str)
@@ -30,3 +34,11 @@ func ToString(v interface{}) string {
return ""
}
}
+
+func RandStr(n int) string {
+ b := make([]byte, n)
+ for i := range b {
+ b[i] = byte(r.Intn(26) + 'a')
+ }
+ return string(b)
+}