sampling

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0, BSD-3-Clause, ISC, + 1 more Imports: 3 Imported by: 0

Documentation

Overview

Package sampling implements secure sampling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSeed

func NewSeed() (seed [32]byte)

NewSeed returns a 32 byte seed populated with cryptographically secure random bytes.

Types

type Source

type Source struct {
	rand.ChaCha8
	// contains filtered or unexported fields
}

func NewSource

func NewSource(seed [32]byte) *Source

func (*Source) Complex128

func (s *Source) Complex128(min, max complex128) complex128

Complex128 returns a pseudo random complex128 in with the real part in the interval [real(min), real(max)), the imag part in the interval [imag(min), imag(max)).

func (*Source) Float64

func (s *Source) Float64(min, max float64) float64

Float64 returns a pseudo random float64 in the interval [min, max).

func (*Source) NewSeed

func (s *Source) NewSeed() (seed [32]byte)

NewSeed returns a new seed populated with bytes generated by the receiver.

func (*Source) NewSource

func (s *Source) NewSource() *Source

NewSource returns a new sampling.Source seeded with bytes generated by the receiver.

func (*Source) Read

func (s *Source) Read(b []byte) (n int, err error)

Read complies to the io.Reader interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳