Documentation

Overview

rand2 is a collection of functions meant to supplement the capabilities provided by the standard "math/rand" package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PickN

func PickN(population []interface{}, n int) (
	picked []interface{}, remaining []interface{}, err error)

Same as 'Sample' except it returns both the 'picked' sample set and the 'remaining' elements.

func Sample

func Sample(population []interface{}, k int) (res []interface{}, err error)

Samples 'k' elements from the given slice

func SampleInts

func SampleInts(n int, k int) (res []int, err error)

Samples 'k' unique ints from the range [0, n)

Types

This section is empty.

Source Files