Skip to content
R

Rand

Fast, high quality alternative to math/rand and golang.org/x/exp/rand

by flyingmutantFree

#574in Education
0In stores

Description

pgregory.net/rand is a Go random number package that is meant as a faster, higher-quality replacement for math/rand and the experimental gol…

Highlights

  • API-compatible with most of math/rand
  • Faster and higher quality, per the benchmarks
  • Simpler generator creation with rand.New()
  • No top-level Seed function or Source interface
  • Benchmarks against several Go random packages

Ratings & Reviews

No ratings yet

Be the first to rate Rand.

People also visit

G

Genesis

All generic functions for Go you ever need!

Developer Tools
Launch
G

golang-benchmark

Golang benchmarking, profiling, and performance measurement

AI Skills
Get
R

Randomix

An open source app to choose randomly between numbers, answers

Developer Tools
Launch
G

golang-performance

Golang performance optimization patterns and methodology

AI Skills
Get
G

golang-popular-libraries

Golang library and framework selection

AI Skills
Get
F

Fastrange

A fast alternative to the modulo reduction

Utilities
Launch

Rand FAQ

What is this package?

A Go random number library that aims to be a faster, higher-quality drop-in for most of math/rand.

How is it different from math/rand?

It keeps the same methods, drops Seed and the Source interface, and makes creating a generator simpler.

Should I use it instead of math/rand/v2?

The author suggests math/rand/v2 unless you are counting nanoseconds. If you are, this package is still faster.

How do I start?

Import pgregory.net/rand, then call rand.New() for a time-seeded generator or rand.New(1) for a fixed seed.

Is the source public?

Yes. The package is published on GitHub, with its benchmarks and FAQ in the README.

What are the best Rand alternatives?

Popular alternatives to Rand include Primesieve and Rust Algorithms. See all Rand alternatives

Developer Stuff

Badges