pcgbasic
Permuted Congruential Generator (PCG) Random Number Generation (RNG) for Nim.
Summary
| Latest Version | 0.1.3 |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-09-03 07:23 |
Tags
Authors
- rockcavera
Installation
nimble install pcgbasic
choosenim install pcgbasic
git clone https://github.com/rockcavera/pcgbasic
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| pcgbasic | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Dependencies
| Package | Version | Optional |
|---|---|---|
| nim >= | 0.19.0 | No |
Source
| Repository | https://github.com/rockcavera/pcgbasic |
|---|---|
| Homepage | https://github.com/rockcavera/pcgbasic |
| Documentation | View Documentation |
| Registry Source | nimble_official |
README
pcgbasic
Permuted Congruential Generator (PCG) Random Number Generation (RNG) for Nim.
This implementation Nim was based on the minimal implementation written in C.
More information: http://www.pcg-random.org/
C implementation: https://github.com/imneme/pcg-c-basic
Install
Run the Nimble install command
nimble install pcgbasic
Basic usage
import pcgbasic, pcgbasic/utils
let seedseq = genSeeds()
var rng: Pcg32Random
# Start an rng
pcg32SRandomR(rng, seedseq.seed, seedseq.seq)
# Return a unit32
echo pcg32RandomR(rng)
# Pick a number between 0 and 99
echo pcg32BoundedRandR(rng, 100'u32)
# Roll a six-sided dice
echo pcg32BoundedRandR(rng, 6'u32) + 1