librng
A collection of PRNG algorithms written in Nim
Summary
| Latest Version | 0.1.3 |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:26 |
Tags
Authors
- xTrayambak
Installation
nimble install librng
choosenim install librng
git clone https://github.com/xTrayambak/librng
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| librng | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Dependencies
| Package | Version | Optional |
|---|---|---|
| nim >= | 1.6.12 | No |
Source
| Repository | https://github.com/xTrayambak/librng |
|---|---|
| Homepage | https://github.com/xTrayambak/librng |
| Registry Source | nimble_official |
README
librng -- RNG for dummies in Nim
librng is a 100% native Nim pseudo-random-number-generation library, supporting multiple algorithms. \
It has no dependencies other than the Nim standard library (granted, you don't count nph as a code formatter) \
You can either individually import an algorithm from the librng/algorithms subdirectory, or you can simply import librng and use the
RNG helper. \
librng supports the C, C++, JS and NimScript* backends.
RNG Algorithms supported
| Algorithm | Status |
|---|---|
| Xoroshiro128 | Yes |
| LCG | Yes |
| Splitmix64 | Yes |
| Mersenne Twister | Yes |
| Marsaglia 69069 | Yes |
| Lehmer64 | Yes |
| Xoroshiro128** | Yes |
| Xoroshiro128++ | Yes |
| PCG | Yes |
| ChaCha20 | No |
Installation
You can install librng straight from Nimble.
$ nimble install librng
Examples
All examples are in examples/. They should give you an idea of how to use the library.
Contributing
Make sure to write unit tests if you're adding a new algorithm. This allows us to integrate it easily into the GitHub Actions tests.
Please run the nimble format task to run nph before submitting your contributions. Thanks :)