rand

package
v0.0.0-...-f506387 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package rand is a helper package wrapping std lib functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Seed

type Seed [32]byte

Seed is a chacha8 randomness seed.

func NewSeed

func NewSeed(s string) Seed

NewSeed creates a certain seed from 32-byte long string. NewSeed panics if s isn't 32-byte long.

func NewSeedRand

func NewSeedRand() Seed

NewSeedRand creates a new random seed using `crypto/rand.Read`.

type Source

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

Source is a randomness source.

func NewSourceChaCha8

func NewSourceChaCha8(seed Seed) Source

NewSourceChaCha8 returns a chacha8 based randomness source.

func (Source) Bool

func (s Source) Bool() bool

Bool returns a random boolean value.

func (Source) Dur

func (s Source) Dur(min, max time.Duration) time.Duration

Dur returns a random duration within the given min and max range.

Jump to

Keyboard shortcuts

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