Using the PCG Library

The PCG library provides access any easy way to use PCG generators. You have several options, all available for download.

C Minimal Library

This is the smallest code. If you want to look at the code, this is probably a not-so-intimidating starting point.

You can use it as a drop-in replacement for rand or rand_r (substituting pcg32_random for rand, and UINT32_MAX for RAND_MAX because the random function always produces a uniformly distributed full-range 32-bit unsigned integer).

Learn more about using the minimal C library....

C++ Library

This version of the code is the canonical version from which all others are derived, and is the most featureful and easiest to use. If you can use C++ in your project, you should probably use this version of the library.

It is provided as a header-only C++ library, modeled after the C++11 random-number facility. You can use it as a drop-in replacement for any C++11 random number generator, although it provides a number of facilities that go beyond those generators.

Learn more about using the C++ library....

C Complete Library

This version of the code provides most of the features of the C++ library (including a full suite of PCG-family generators). It's provided on the basis that some people cannot use C.

Learn more about using the ....