mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-04-02 07:15:02 -05:00
It won't let me add a commit message but I fixed parsing multiple Gamespy messages + the get profile.
31 lines
523 B
Go
31 lines
523 B
Go
package common
|
|
|
|
import (
|
|
"math/rand"
|
|
"time"
|
|
)
|
|
|
|
var letterRunes = []rune("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
|
|
|
|
func RandomString(n int) string {
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
|
b := make([]rune, n)
|
|
for i := range b {
|
|
b[i] = letterRunes[rand.Intn(len(letterRunes))]
|
|
}
|
|
return string(b)
|
|
}
|
|
|
|
var hexRunes = []rune("0123456789abcdefabcdef")
|
|
|
|
func RandomHexString(n int) string {
|
|
rand.Seed(time.Now().UnixNano())
|
|
|
|
b := make([]rune, n)
|
|
for i := range b {
|
|
b[i] = letterRunes[rand.Intn(len(hexRunes))]
|
|
}
|
|
return string(b)
|
|
}
|