Skip to content

Small package for generation common types of pseudorandom data

Notifications You must be signed in to change notification settings

thedanielforum/randtool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

godoc Codacy Badge

GO package with some easy tools for generating common types of pseudo random data.

Installation

go get github.com/thedanielforum/randtool

Usage Examples Generate a random string of n length.

// Generate a random 16 char string
str, err := randtool.GenStr(16)
// Generate a new string but ignore any potential errors
str := randtool.GenStrIgnoreErr(16)

Avalible integers

GenInt64() int64
GenInt32() int32
GenInt16() int16
GenInt8() int8

Generate random number within specified range

// Good for mobile verification challenges
i := randtool.GenIntRange(1000, 9999)

Benchmarks

go test -bench=.
BenchmarkGenInt64	 2000000	       715 ns/op	      16 B/op	       2 allocs/op
BenchmarkGenStr  	10000000	       235 ns/op	      32 B/op	       2 allocs/op

About

Small package for generation common types of pseudorandom data

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages