feat: add MustGenerate overload

This commit is contained in:
Peter 2023-04-25 17:54:20 +02:00
parent 997460bbdc
commit 81e23c0436
No known key found for this signature in database

View file

@ -18,6 +18,14 @@ func Generate(opts ...GenerationOption) (string, error) {
return Default.Generate(opts...)
}
func MustGenerate(opts ...GenerationOption) string {
if pw, err := Generate(opts...); err != nil {
panic(err)
} else {
return pw
}
}
func NewDefaultGenerator(prng Int32n) DefaultGenerator {
if prng == nil {
prng = rand.New(rand.NewSource(time.Now().UnixNano()))