Files
rands/rands.go
Jim Myhrberg 22fe517baa feat(randsmust): add randsmust package
randsmust is specifically intended as an alternative to rands for use in
tests. All functions return a single value, and panic in the event of an
error. This makes them easy to use when building structs in test cases
that need random data.

Internally the package simply calls the equivalent function from the
rands package, and panics if a error is returned.
2021-12-17 11:03:32 +00:00

19 lines
704 B
Go

// Package rands provides a suite of functions that use crypto/rand to generate
// cryptographically secure random strings in various formats, as well as ints
// and bytes.
//
// All functions which produce strings from a alphabet of characters uses
// rand.Int() to ensure a uniform distribution of all possible values.
//
// rands is intended for use in production code where random data generation is
// required. All functions have a error return value, which should be
// checked.
//
// For tests there is the randsmust package, which has all the same functions
// but with single return values, and they panic in the event of an error.
package rands
import "errors"
var Err = errors.New("rands")