rand

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Namespace

type Namespace struct {
	// contains filtered or unexported fields
}

Namespace defines the methods for reflect to be used as template functions.

func New

func New(d *deps.Deps) *Namespace

Creates a new reflect Namespace

func (*Namespace) Alpha

func (ns *Namespace) Alpha(length int64) string

Alpha

Returns a random alpha string by the given length.

Example: {{ randAlpha 20 }}

func (*Namespace) AlphaNum

func (ns *Namespace) AlphaNum(length int64) string

AlphaNum

Returns a random alpha numeric string by the given length.

Example: {{ randAlphaNum 20 }}

func (*Namespace) Float

func (ns *Namespace) Float(a, b interface{}) float64

Float

Returns a random float between min and max values.

Example: {{ randFloat 2.5 10 }}

func (*Namespace) Int

func (ns *Namespace) Int(a, b interface{}) int

Int

Returns a random integer between min and max values.

Example: {{ randInt 1 10 }}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL