randutil

package
v0.0.0-...-a313e43 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandBytes

func RandBytes(size int) []byte

RandBytes returns a byte slice of the given length with random data.

func WeightedChoice

func WeightedChoice(weights []float64) int

WeightedChoice takes a slice of positive weights, and returns a random index from [0, len(weights)) with probability of index i being proportional to weight i. Returns -1 for erroneous conditions like a weight being negative.

Types

This section is empty.

Jump to

Keyboard shortcuts

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