decred / dcrd

Decred daemon in Go (golang).
https://decred.org
ISC License
731 stars 289 forks source link

crypto/rand: Implement module. #3371

Closed jrick closed 1 month ago

jrick commented 1 month ago

The github.com/decred/dcrd/crypto/rand module provides an alternative to the standard library's math/rand, math/rand/v2, and crypto/rand packages. It implements a package-global fast userspace CSPRNG that never errors after initial seeding at init time with the ability to create additional PRNGs without locking overhead if needed. In addition to providing random bytes, the PRNG is also capable of generating cryptographically secure integers with uniform distribution, and provides a Fisher-Yates shuffle function that can be used to shuffle slices with random indexes.