csrand

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

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

Go to latest
Published: Dec 4, 2024 License: BSD-2-Clause, BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package csrand implements the math/rand interface over crypto/rand, along with some utility functions for common random number/byte related tasks.

Not all of the convinience routines are replicated, only those that are immediately useful. The Rand variable provides access to the full math/rand API.

Index

Constants

This section is empty.

Variables

View Source
var (

	// Rand is a math/rand instance backed by crypto/rand CSPRNG.
	Rand = rand.New(csRandSourceInstance)
)

Reader is a alias of rand.Reader.

Functions

func Bytes

func Bytes(buf []byte) error

Bytes fills the slice with random data.

func Float64

func Float64() float64

Float64 returns, as a float64, a pesudo random number in [0.0,1.0).

func IntRange

func IntRange(min, max int) int

IntRange returns a uniformly distributed int [min, max].

func Intn

func Intn(n int) int

Intn returns, as a int, a pseudo random number in [0, n).

Types

This section is empty.

Jump to

Keyboard shortcuts

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