Skip to content
/ rand Public

This is a library for generating various random data to use in the program.

License

Notifications You must be signed in to change notification settings

135yshr/rand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

randstr

go Go Report Card GoDoc MIT License

This is a library for generating various random data to use in the program.

Prerequisites

  • Go: 1.18+

Installation

go get -u github.com/135yshr/rand

Lean more

How to generate random ID

The 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))
}

How to generate random Password

import (
	"fmt"

	"github.com/135yshr/rand/randstr"
)

func main() {
	gen := randstr.NewPasswordGenerator()
	fmt.Printf("Generated password: %s\n", gen.Generate(12))
}

How to generate random string

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))
}

Contributing

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!

License

This project is released under the MIT license. See the LICENSE file for details.

About

This is a library for generating various random data to use in the program.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors