random

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Source source

Source is a cryptographically secure random number source that satisfies the math/rand.Source and math/rand.Source64 interfaces, which are required to make a new math/rand.Rand instance that uses crypto/rand. See also New, for a new Rand instance using this source.

Functions

func New

func New() *rand.Rand

New creates a new math/rand.Rand number generator that uses the cryptographically secure source of randomness. This is helpful for the versatile methods like Intn, Float64, etc., which crypto/rand does not provide. If you just need bytes, use the standard library's crypto/rand.Read.

func String

func String(length int) string

String returns a random string of alphanumeric characters. The first character will be a letter. If you need the first character to include digits, generate a longer string and trim the first character.

Types

This section is empty.

Jump to

Keyboard shortcuts

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