mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-30 17:46:41 +08:00
24 lines
362 B
Go
24 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
|
|
}
|