rands
Go package providing a suite of functions that use crypto/rand
to generate cryptographically secure random strings in various formats, as
well as ints and bytes.
```go
s, err := rands.Base64(16) // => CYxqEdUB1Rzno3SyZu2g/g==
s, err := rands.Base64URL(16) // => zlqw9aFqcFggbk2asn3_aQ
s, err := rands.Hex(16) // => 956e2ec9e7f19ddd58bb935826926531
s, err := rands.Alphanumeric(16) // => Fvk1PkrmG5crgOjT
s, err := rands.Alphabetic(16) // => XEJIzcZufHkuUmRM
s, err := rands.Upper(16) // => UMAGAFPPNDRGLUPZ
s, err := rands.UpperNumeric(16) // => DF0CQS0TK9CPUO3E
s, err := rands.Lower(16) // => ocsmggykzrxzfwgt
s, err := rands.LowerNumeric(16) // => rwlv7a1p7klqffs5
s, err := rands.Numeric(16) // => 9403373143598295
s, err := rands.String(16, "abcdefABCDEF") // => adCDCaDEdeffeDeb
s, err := rands.UnicodeString(16, []rune("九七二人入八力十下三千上口土夕大")) // => 下下口九力下土夕下土八上二夕大三
s, err := rands.DNSLabel(16) // => z0ij9o8qkbs0ru-h
s, err := rands.UUID() // => a62b8712-f238-43ba-a47e-333f5fffe785
n, err := rands.Int(2147483647) // => 1334400235
n, err := rands.Int64(int64(9223372036854775807)) // => 8256935979116161233
b, err := rands.Bytes(8) // => [0 220 137 243 135 204 34 63]
```
## Import
```
import "github.com/jimeh/rands"
```
## Documentation
Please see the
[Go Reference](https://pkg.go.dev/github.com/jimeh/rands#section-documentation)
for documentation and examples.
## Benchmarks
Benchmark reports and graphs are available here:
https://jimeh.me/rands/dev/bench/
## License
[MIT](https://github.com/jimeh/rands/blob/master/LICENSE)