28 lines
641 B
Go
28 lines
641 B
Go
/*
|
|
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
|
|
*
|
|
* This work is published and licensed under a Creative Commons
|
|
* Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
|
*
|
|
* Distribution of this work is permitted, but commercial use and
|
|
* modifications are strictly prohibited.
|
|
*/
|
|
/*
|
|
* Copyright 2019 Oleg Borodin <borodin@unix7.org>
|
|
*/
|
|
|
|
package auxtool
|
|
|
|
import (
|
|
"math/rand"
|
|
)
|
|
|
|
func RandomString(n int) string {
|
|
const letters = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
arr := make([]byte, n)
|
|
for i := range arr {
|
|
arr[i] = letters[rand.Intn(len(letters))]
|
|
}
|
|
return string(arr)
|
|
}
|