Files
llink/go/internal/utils/random_generator.go
Arjun Patel d262f734f0 Mobile notifications for iOS (#210)
* mobile: wire notification registration and listener

* implement backend components for push notifications

* refactor: agentic comment cleanup

* docs: use proper module name for particle processor

* set required env variables for push notifications

* bump version

* fix: always upsert push token on mobile start

* Revert "fix: always upsert push token on mobile start"

This reverts commit 90ff18a788.

* send push notifications regardless of online status
2026-05-18 12:44:31 -07:00

31 lines
534 B
Go

package utils
import (
"math/rand"
"strings"
)
const (
charset = "abcdefghijklmnopqrstuvwxyz0123456789"
charsetNumbers = "0123456789"
)
func RandomString(length int) string {
sb := strings.Builder{}
sb.Grow(length)
for i := 0; i < length; i++ {
sb.WriteByte(charset[rand.Intn(len(charset))])
}
return sb.String()
}
func RandomStringNumbers(length int) string {
sb := strings.Builder{}
sb.Grow(length)
for range length {
sb.WriteByte(charsetNumbers[rand.Intn(len(charsetNumbers))])
}
return sb.String()
}