README.md
1# PCG Random Number Generation, Minimal C Edition
2
3[PCG-Random website]: http://www.pcg-random.org
4
5This code provides a minimal implementation of one member of the PCG family
6of random number generators, which are fast, statistically excellent,
7and offer a number of useful features.
8
9Full details can be found at the [PCG-Random website]. This version
10of the code provides a single family member and skips some useful features
11(such as jump-ahead/jump-back) -- if you want a more full-featured library,
12you may prefer the full version of the C library, or for all features,
13the C++ library.
14
15## Documentation and Examples
16
17Visit [PCG-Random website] for information on how to use this library, or look
18at the sample code -- hopefully it should be fairly self explanatory.
19
20## Building
21
22There is no library to build. Just use the code. You can however build the
23three demo programs.
24
25The code is written in C89-style C with no significant platform dependencies.
26On a Unix-style system (e.g., Linux, Mac OS X), or any system with `make`,
27you should be able to just type type
28
29 make
30
31Almost all the real code is in `pcg_basic.c`, with type and function
32declarations in `pcg_basic.h`.
33
34On other systems, it should be straightforward to build. For example, you
35even run the code directly using the tinycc compiler, using
36
37 cat pcg_basic.c pcg32-demo.c | tcc -run
38
39## Testing
40
41This command will build the three provided demo programs, `pcg32-global-demo`
42(which uses the global rng), `pcg32-demo` (which uses a local generator), and
43pcg32x2-demo (which gangs together two generators, showing the usefulness of
44creating multiple generators).
45
46To run the demos using a fixed seed (same output every time), run
47
48 ./pcg32-demo
49
50To produce different output, run
51
52 ./pcg32-demo -r
53
54You can also pass an integer count to specify how may rounds of output you
55would like.