randx

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package randx contains randomization functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String(n int, alphabet []rune) string

String returns a string of length n, composed of random characters from the provided alphabet. If the input slice is nil, returns a random mixed case alphanumeric string.

Types

type Rand

type Rand interface {
	Int() int
	Intn(n int) int
	Int31() int32
	Int31n(n int32) int32
	Int63() int64
	Int63n(n int64) int64
	Float32() float32
	Float64() float64
	Read(p []byte) (n int, err error)
	String(n int, alphabet []rune) string
}

Rand can generate random values of various types.

func New

func New(src rand.Source) Rand

New creates a new RNG around a given source.

Jump to

Keyboard shortcuts

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