rand

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MPL-2.0 Imports: 8 Imported by: 2

Documentation

Overview

Package rand implements functions similar to math/rand in the standard library, but on top of a secure random number generator.

Index

Constants

This section is empty.

Variables

View Source
var Reader = defaultSecureSource

Reader is the standard crypto/rand.Reader with added buffering.

Functions

func Int63

func Int63() int64

Int63 returns a cryptographically secure random int63.

func Intn

func Intn(n int) int

Intn returns, as an int, a cryptographically secure non-negative random number in [0,n). It panics if n <= 0.

func Read added in v1.15.0

func Read(p []byte) (int, error)

func Shuffle added in v1.2.0

func Shuffle(slice interface{})

Shuffle the order of elements in slice.

func String

func String(l int) string

String returns a cryptographically secure random string of characters (taken from randomCharset) of the specified length. The returned string contains ~5.8 bits of entropy per character, due to the character set used.

func Uint64 added in v1.8.0

func Uint64() uint64

Uint64 returns a cryptographically secure strongly random uint64.

Types

This section is empty.

Jump to

Keyboard shortcuts

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