项目作者: go-passwd

项目描述 :
Flexible and customizable random string generator
高级语言: Go
项目地址: git://github.com/go-passwd/randomstring.git
创建时间: 2018-07-29T12:24:16Z
项目社区:https://github.com/go-passwd/randomstring

开源协议:MIT License

下载


Go random string generator

Build Status
Coverage Status
Go Report Card
GoDoc

Usage

  1. import "github.com/go-passwd/randomstring"

Documentation

https://go-passwd.github.io/randomstring.html

Rules functions

Length rule function

Returns a length of a string to generate.

  1. NewLength(n uint)

Sets string length to n.

  1. NewLengthRange(min, max uint)

Sets string length to length between min and max

Charset rule function

Modify a charset and returns it.

  1. NewIncludeCharset(chars string)

Add chars to charset.

  1. NewExcludeCharset(chars string)

Removes chars from charset.

Output rule function

  1. NewBeginWith(letters string)

Checks if newly selected at random char does start with a one of letters.
Function only executed at first char.

  1. NewNoDuplicateCharacters()

Checks if string doesn’t have newly selected at random char.

  1. NewNoSequentialCharacters(n uint)

Checks if string doesn’t have n sequentials characters.

Generate rule function

Generates a new string based on: charset, length and output rules.

  1. NewDefaultGenerate()

Simple random string generator.