Skip to content

Latest commit

 

History

History
56 lines (38 loc) · 1.78 KB

README.md

File metadata and controls

56 lines (38 loc) · 1.78 KB

pcglite

build

pcglite is a lightweight subset of pcg-cpp, the original C++ implementation of PCG random number generator.

Features

  • A template class permuted_congruential_engine<UIntType> 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 <random> 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 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.

Usage

See test/example.cpp.