rand

package
v1.1.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2016 License: Apache-2.0, Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package rand provides utilities related to randomization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int63nRange added in v1.1.0

func Int63nRange(min, max int64) int64

IntnRange generates an int64 integer in range [min,max). By design this should panic if input is invalid, <= 0.

func Intn

func Intn(max int) int

Intn generates an integer in range [0,max). By design this should panic if input is invalid, <= 0.

func IntnRange added in v1.1.0

func IntnRange(min, max int) int

IntnRange generates an integer in range [min,max). By design this should panic if input is invalid, <= 0.

func Perm

func Perm(n int) []int

Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n) from the default Source.

func Seed

func Seed(seed int64)

Seed seeds the rng with the provided seed.

func Shuffle added in v1.1.0

func Shuffle(data Shufflable)

func String

func String(length int) string

String generates a random alphanumeric string n characters long. This will panic if n is less than zero.

Types

type Shufflable added in v1.1.0

type Shufflable interface {
	Len() int
	Swap(i, j int)
}

A type that satisfies the rand.Shufflable interface can be shuffled by Shuffle. Any sort.Interface will satisfy this interface.

Jump to

Keyboard shortcuts

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