rand

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RouletteDrawN

func RouletteDrawN(p []float64, n int) ([]int, error)

RouletteDrawN draws n numbers randomly from a probability mass function (PMF) defined by weights in p. RouletteDrawN implements the Roulette Wheel Draw a.k.a. Fitness Proportionate Selection: - https://en.wikipedia.org/wiki/Fitness_proportionate_selection - http://www.keithschwarz.com/darts-dice-coins/ It returns a slice of n indices into the vector p. It fails with error if p is empty or nil.

func WithCovN

func WithCovN(cov mat.Symmetric, n int) (*mat.Dense, error)

WithCovN draws n random samples from a zero-mean Normal (aka Gaussian) distribution with covariance cov. It returns matrix which contains the randomly generated samples stored in its columns. It fails with error if n is non-positive and/or smaller than 1 or if SVD factorization of cov fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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