/prng-c

An abstraction for pseudo random number generators in C99.

Primary LanguageC++MIT LicenseMIT

prng-c

PRNG-C provides an interface for pseudo random number generators compatible with C (C89 and up) and C++ (C++98 and up). This library is header-only.

Its primary intention is serve statistical simulations. Therefore, this library includes specific distributions which a random sample can be drawn from.

Namespacing

This library is namespaced for both C and C++.

In C all functions and complex data structures are prefixed by PRNG_ if it is meant to be a consumer API or by prng_ if it is meant to be used internally.

In C++ the namespace prng is set. All functions and complex data structures are written in Pascal case if they are meant for consumer APIs and camelCase if they are used internally.

In the following only the C namespace is used.

List of Pseudo Random Number Generators (PRNGs)

  • xorshift1024* (here) is given as struct PRNG_Xorshift1024Star.

  • splitmix64 (here) is only used for seeding. It is given as struct prng_sm64.

List of Univariate Distributions

  • Normal distribution with mean 0 and standard deviation 1: PRNG_BoxMuller.

List of Multivariate Distributions

... to be done ...

Examples

C as well as C++ examples can be found in the examples directory.