rand

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0, BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package rand provides methods for generating random numbers from distributions useful for the differential privacy library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Boolean

func Boolean() bool

Boolean returns true or false with equal probability.

func Geometric

func Geometric() float64

Geometric returns a float64 that counts the number of Bernoulli trials until the first success for a success probability of 0.5.

func I63n

func I63n(n int64) int64

I63n returns an integer from the set {0,...,n-1} uniformly at random. The value of n must be positive.

func Normal

func Normal() float64

Normal returns a normally distributed float with mean 0 and standard deviation 1.

func Sign

func Sign() float64

Sign returns +1.0 or -1.0 with equal probabilities.

func U64

func U64() uint64

U64 returns a uniformly random uint64.

func U8

func U8() uint8

U8 returns a uniformly random uint8.

func Uniform

func Uniform() float64

Uniform returns a float64 from the interval (0,1] such that each float in the interval is returned with positive probability and the resulting distribution simulates a continuous uniform distribution on (0, 1].

See http://g/go-nuts/GndbDnHKHuw/VNSrkl9vBQAJ for details.

Types

This section is empty.

Jump to

Keyboard shortcuts

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