Add Random Generator

This commit is contained in:
Dan Jones 2025-03-15 15:36:43 -05:00
commit 1677a692d1
8 changed files with 142 additions and 53 deletions

36
gen_rand_examples_test.go Normal file
View file

@ -0,0 +1,36 @@
package nomino_test
import (
"fmt"
"codeberg.org/danjones000/nomino"
)
func ExampleUUID() {
option := nomino.WithGenerator(nomino.UUID())
str, _ := nomino.Make(nomino.NewConfig(option))
fmt.Println(str)
str, _ = nomino.Make(nomino.NewConfig(option))
fmt.Println(str)
str, _ = nomino.Make(nomino.NewConfig(option))
fmt.Println(str)
}
func ExampleRandom() {
option := nomino.WithGenerator(nomino.Random())
str, _ := nomino.Make(nomino.NewConfig(option))
fmt.Println(str)
}
func ExampleRandomLength() {
option := nomino.WithGenerator(nomino.Random(
nomino.RandomLength(32),
))
str, _ := nomino.Make(nomino.NewConfig(option))
fmt.Println(str)
}