pcglite is a lightweight subset of pcg-cpp, the original C++ implementation of PCG random number generator.
- A template class
permuted_congruential_engine<UIntType>
supportsuint32_t
anduint64_t
output. - Two aliases for specialized classes:
pcglite::pcg32
andpcglite::pcg64
. - Compliant to
UniformRandomBitGenerator
requirements; usable with various distributions in<random>
as a drop-in replacement of the standard generators such asstd::mt19937
. - Single header.
- CMake-ready.
- C++17 compiler
pcg64
requires__uint128_t
. It is not in the C++ standard, but is available in most environments with Clang and GCC.
Modern CMake can populate this package into your project with FetchContent module.
Alternatively, you can get the source code from GitHub, and install it into your system with CMake:
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:
brew install heavywatal/tap/pcglite
Header files are installed to ${CMAKE_INSTALL_PREFIX}/include/pcglite/
.
This library can be imported from other CMake projects:
find_package(pcglite)
target_link_libraries(${YOUR_TARGET} PRIVATE pcglite::pcglite)
Of course you can manually put pcglite.hpp
anywhere you like.
See test/example.cpp
.