random

package
v0.0.0-...-7f48f6c Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenFloat64

func GenFloat64(max float64) (float64, error)

func GenFloat64InRange

func GenFloat64InRange(min, max float64) (float64, error)

func GenFloat64Norm

func GenFloat64Norm(stdDev, mean float64) (float64, error)

GenFloat64Norm generate random float64 with norm

stdDev -standart deviation - σ^2; default = 1

mean - μ (In probability theory, the expected value is a generalization of the weighted average.); default = 0

func GenFloat64NormInRange

func GenFloat64NormInRange(min, max, stdDev, mean float64) (float64, error)

func GenInt

func GenInt(max int) (int, error)

func GenIntInRange

func GenIntInRange(min int, max int) (int, error)

func GenNanoString

func GenNanoString(l int) (string, error)

func GenUUID

func GenUUID() uuid.UUID

func GenUUIDString

func GenUUIDString() string

func GetSnowflakeID

func GetSnowflakeID[T interface{}](ctx context.Context, n int64, cb GetEntityByIDCallback[T]) (int64, error)

Types

type GetEntityByIDCallback

type GetEntityByIDCallback[T interface{}] func(ctx context.Context, id int64) (*T, error)

type Node

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

func NewSnowflakeNode

func NewSnowflakeNode(node int64) (*Node, error)

func (*Node) GenerateInt64

func (n *Node) GenerateInt64() int64

Jump to

Keyboard shortcuts

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