BareRTC/pkg/util/strings.go
Noah Petherbridge 8f60bdba0e Spit and polish
* Add configuration system and default public channels support
* Add support for multiple channels and DM threads with users,
  with unread badge indicators. DMs rearrange themselves by
  most recently updated on top.
* Responsive CSS to work well on mobile devices.
2023-02-05 00:53:50 -08:00

14 lines
300 B
Go

package util
import "math/rand"
// RandomString returns a random string of any length.
func RandomString(n int) string {
const charset = "abcdefghijklmnopqrstuvwxyz"
var result = make([]byte, n)
for i := 0; i < n; i++ {
result[i] = charset[rand.Intn(len(charset))]
}
return string(result)
}