This is a library for generating various random data to use in the program.
- Go: 1.18+
go get -u github.com/135yshr/randThe ID generator creates a string using alphanumeric characters.
import (
"fmt"
"github.com/135yshr/rand/randstr"
)
func main() {
gen := randstr.NewUserNameGenerator()
fmt.Printf("Generated ID: %s\n", gen.Generate(8))
}import (
"fmt"
"github.com/135yshr/rand/randstr"
)
func main() {
gen := randstr.NewPasswordGenerator()
fmt.Printf("Generated password: %s\n", gen.Generate(12))
}When you want to use specified characters, please use the custom generator.
import (
"fmt"
"github.com/135yshr/rand/randstr"
)
func main() {
gen := randstr.NewCustomGenerator("abcdef01234567890-/")
fmt.Printf("Generated random string: %s\n", gen.Generate(10))
}This project is an open-source endeavor that thrives on your active participation. We're always on the lookout for individuals interested in contributing to the project's growth. If you have any ideas or improvements, no matter how small, they are welcome. Feel free to submit a pull request at any time. We're eagerly awaiting your collaboration!
This project is released under the MIT license. See the LICENSE file for details.