uniformprng

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Package uniformprng implements a uniform, cryptographically secure pseudo-random number generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source returns cryptographically-secure pseudorandom numbers with uniform distribution.

func NewSource

func NewSource(seed *[32]byte) *Source

NewSource seeds a Source from a 32-byte key.

func RandSource

func RandSource(rand io.Reader) (*Source, error)

RandSource creates a Source with seed randomness read from rand.

func (*Source) Int63

func (s *Source) Int63() int64

Int63 returns a pseudo-random 63-bit positive integer as an int64 without modulo bias.

func (*Source) Int63n

func (s *Source) Int63n(n int64) int64

Int63n returns, as an int64, a pseudo-random 63-bit positive integer in [0,n) without modulo bias. It panics if n <= 0.

func (*Source) Uint32

func (s *Source) Uint32() uint32

Uint32 returns a pseudo-random uint32.

func (*Source) Uint32n

func (s *Source) Uint32n(n uint32) uint32

Uint32n returns a pseudo-random uint32 in range [0,n) without modulo bias.

Jump to

Keyboard shortcuts

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