项目作者: LyricTian

项目描述 :
A random library for Go.
高级语言: Go
项目地址: git://github.com/LyricTian/rand.git
创建时间: 2018-11-01T11:17:22Z
项目社区:https://github.com/LyricTian/rand

开源协议:MIT License

下载


rand

A random library for Go.

Build Codecov ReportCard GoDoc License

Usage

  1. $ go get -u -v github.com/LyricTian/rand

Import package

  1. import "github.com/LyricTian/rand"

Generate a random string

  1. rand.MustRandom(6, rand.Ldigit)
  2. // 939430

Generate a short string

  1. rand.MustShortStr([]byte("https://www.google.com"), 6, rand.Ldigit)
  2. // [XZ1599 Xy8I3U KAHc2K NftD8p]

Random flag:

  • Ldigit
  • LlowerCase
  • LupperCase
  • LlowerAndUpperCase
  • LdigitAndLowerCase
  • LdigitAndUpperCase
  • LdigitAndLetter

Generate a random UUID

  1. rand.MustUUID()
  2. // a306e54f-672f-4011-889d-d09e98cbea89

MIT License

  1. Copyright (c) 2018 Lyric