LyricTian / rand

A random library for Go.

Home Page:https://godoc.org/github.com/LyricTian/rand

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rand

A random library for Go.

Build Codecov ReportCard GoDoc License

Usage

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

Import package

import "github.com/LyricTian/rand"

Generate a random string

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

Generate a short string

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

Random flag:

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

Generate a random UUID

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

MIT License

Copyright (c) 2018 Lyric

About

A random library for Go.

https://godoc.org/github.com/LyricTian/rand

License:MIT License


Languages

Language:Go 100.0%