package rand
import "gvisor.dev/gvisor/pkg/rand"
Package rand implements a cryptographically secure pseudorandom number generator.
Index ¶
- Variables
- func Init() error
- func Int63() int64
- func Int63n(n int64) int64
- func Read(b []byte) (int, error)
- func Uint32() uint32
- func Uint64() uint64
- type RNG
Variables ¶
Reader is the default reader.
Functions ¶
func Init ¶
func Init() error
Init can be called to make sure /dev/urandom is pre-opened on kernels that do not support getrandom(2).
func Int63 ¶
func Int63() int64
Int63 is analogous to the standard library's math/rand.Int63.
func Int63n ¶
Int63n is analogous to the standard library's math/rand.Int63n.
func Read ¶
Read reads from the default reader.
func Uint32 ¶
func Uint32() uint32
Uint32 is analogous to the standard library's math/rand.Uint32.
func Uint64 ¶
func Uint64() uint64
Uint64 is analogous to the standard library's math/rand.Uint64.
Types ¶
type RNG ¶
RNG exposes convenience functions based on a cryptographically secure io.Reader.
func RNGFrom ¶
RNGFrom returns a new RNG. r must be a cryptographically secure io.Reader.
func (*RNG) Int63 ¶
Int63 is analogous to the standard library's math/rand.Int63.
func (*RNG) Int63n ¶
Int63n is analogous to the standard library's math/rand.Int63n.
func (*RNG) Uint16 ¶
Uint16 is analogous to the standard library's math/rand.Uint16.
func (*RNG) Uint32 ¶
Uint32 is analogous to the standard library's math/rand.Uint32.
func (*RNG) Uint64 ¶
Uint64 is analogous to the standard library's math/rand.Uint64.
Source Files ¶
rand_linux.go rng.go
- Version
- v0.0.0-20250605235530-a6711d1e1dc6 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 4 hours ago –
Tools for package owners.