rand

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 2 more Imports: 2 Imported by: 0

Documentation

Overview

Package rand provides public goroutine-safe random function. The implementation is similar to grpc random functions. Additionally, the seed function is provided to be called from the outside, and the random functions are provided as a struct's methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SafeRand

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

SafeRand is the safe random functions struct.

func NewSafeRand

func NewSafeRand(seed int64) *SafeRand

NewSafeRand creates a SafeRand using the given seed.

func (*SafeRand) Float64

func (c *SafeRand) Float64() float64

Float64 provides a random float64.

func (*SafeRand) Int63n

func (c *SafeRand) Int63n(n int64) int64

Int63n provides a random int64.

func (*SafeRand) Intn

func (c *SafeRand) Intn(n int) int

Intn provides a random int.

Jump to

Keyboard shortcuts

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