fastrand

package
v0.0.0-...-a152fe2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package fastrand implements fast pesudorandom number generator that should scale well on multi-CPU systems.

Use crypto/rand instead of this package for generating cryptographically secure random numbers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Uint32

func Uint32() uint32

Uint32 returns pseudorandom uint32.

It is safe calling this function from concurrent goroutines.

func Uint32n

func Uint32n(maxN uint32) uint32

Uint32n returns pseudorandom uint32 in the range [0..maxN).

It is safe calling this function from concurrent goroutines.

Types

type RNG

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

RNG is a pseudorandom number generator.

It is unsafe to call RNG methods from concurrent goroutines.

func (*RNG) Seed

func (r *RNG) Seed(n uint32)

Seed sets the r state to n.

func (*RNG) Uint32

func (r *RNG) Uint32() uint32

Uint32 returns pseudorandom uint32.

It is unsafe to call this method from concurrent goroutines.

func (*RNG) Uint32n

func (r *RNG) Uint32n(maxN uint32) uint32

Uint32n returns pseudorandom uint32 in the range [0..maxN).

It is unsafe to call this method from concurrent goroutines.

Jump to

Keyboard shortcuts

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