random

package
v3.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package random implements goroutine-safe utilities on top of a secure random source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(n int) []byte

Bytes generates a random byte slice of length n.

func CanJitter added in v3.27.1

func CanJitter(d time.Duration, p float64) bool

CanJitter checks if the provided duration `d` can be used with the Jitter function with the provided percentage p.

func Int63n added in v3.16.2

func Int63n(n int64) int64

Int63n returns a random number in the range [0,n).

func Jitter

func Jitter(d time.Duration, p float64) time.Duration

Jitter returns a random number around d where p is the maximum percentage of change applied to d. With d=100 and p=0.1, the duration returned will be in [90,110].

func String

func String(n int) string

String returns a random string of length n, it uses the characters of base64.URLEncoding.

Types

This section is empty.

Jump to

Keyboard shortcuts

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