Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/heavywatal/pcglite
🎲 Lightweight subset of pcg-cpp random number generators
https://github.com/heavywatal/pcglite
pcg random-number-generators rng
Last synced: 7 days ago
JSON representation
🎲 Lightweight subset of pcg-cpp random number generators
- Host: GitHub
- URL: https://github.com/heavywatal/pcglite
- Owner: heavywatal
- License: mit
- Created: 2024-10-24T05:47:45.000Z (23 days ago)
- Default Branch: main
- Last Pushed: 2024-11-02T04:09:06.000Z (14 days ago)
- Last Synced: 2024-11-02T05:17:16.459Z (14 days ago)
- Topics: pcg, random-number-generators, rng
- Language: C++
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## pcglite
[![build](https://github.com/heavywatal/pcglite/actions/workflows/build.yaml/badge.svg)](https://github.com/heavywatal/pcglite/actions/workflows/build.yaml)
pcglite is a lightweight subset of [pcg-cpp](https://github.com/imneme/pcg-cpp),
the original C++ implementation of [PCG random number generator](https://www.pcg-random.org/).### Features
- A template class `permuted_congruential_engine` supports `uint32_t` and `uint64_t` output.
- Two aliases for specialized classes: `pcglite::pcg32` and `pcglite::pcg64`.
- Compliant to `UniformRandomBitGenerator` requirements;
usable with various distributions in `` as a drop-in replacement of the standard generators such as `std::mt19937`.
- Single header.
- CMake-ready.### Dependency
- C++17 compiler
- `pcg64` requires `__uint128_t`.
It is not in the C++ standard, but is available in most environments with Clang and GCC.### Installation
Modern CMake can populate this package into your project with [FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) module.
Alternatively, you can get the source code from GitHub, and install it into your system with CMake:
```sh
git clone https://github.com/heavywatal/pcglite.git
cd pcglite/
cmake -S . -B build -DCMAKE_INSTALL_PREFIX=${HOME}/local
cmake --build build
cmake --install build
```The easiest way for system-wide installation is to use [Homebrew](https://brew.sh/):
```sh
brew install heavywatal/tap/pcglite
```Header files are installed to `${CMAKE_INSTALL_PREFIX}/include/pcglite/`.
This library can be imported from other CMake projects:
```cmake
find_package(pcglite)
target_link_libraries(${YOUR_TARGET} PRIVATE pcglite::pcglite)
```Of course you can manually put `pcglite.hpp` anywhere you like.
### Usage
See `test/example.cpp`.