hatecomputers.club/utils/RandomId.go

17 lines
189 B
Go
Raw Normal View History

2024-03-27 17:02:31 -04:00
package utils
import (
"crypto/rand"
"fmt"
)
func RandomId() string {
2024-03-28 12:53:30 -04:00
id := make([]byte, 16)
_, err := rand.Read(id)
2024-03-27 17:02:31 -04:00
if err != nil {
panic(err)
}
2024-03-28 12:53:30 -04:00
return fmt.Sprintf("%x", id)
2024-03-27 17:02:31 -04:00
}