mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 16:32:31 +01:00
23 lines
362 B
Go
23 lines
362 B
Go
package common
|
|
|
|
import (
|
|
"math/rand"
|
|
)
|
|
|
|
var Letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
|
|
|
func RandomString(n int) string {
|
|
b := make([]rune, n)
|
|
for i := range b {
|
|
b[i] = Letters[rand.Intn(len(Letters))]
|
|
}
|
|
return string(b)
|
|
}
|
|
|
|
func NewBool(t bool) *bool {
|
|
return &t
|
|
}
|
|
|
|
func NewString(t string) *string {
|
|
return &t
|
|
}
|