xrand

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package xrand provides helper functions for generating random numbers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(size int) []byte

Bytes returns an amount of cryptographically-secure random bytes equal to the the specified size.

The bytes are generated using the crypto/rand package and will panic if crypto/rand fails to generate the requested amount of bytes.

Defaults to 32 if no size is specified.

func BytesWithReader

func BytesWithReader(size int, reader io.Reader) []byte

BytesWithReader is like Bytes, but allows you to specify your own reader.

Types

type UUID added in v0.12.0

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

UUID represents a 128-bit Universal Unique Identifier (UUID) as defined in RFC 4122.

func (*UUID) GenerateV4 added in v0.12.0

func (u *UUID) GenerateV4() string

Generate generates a UUIDv4 and returns it as a string.

Jump to

Keyboard shortcuts

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