8000 GitHub - DDexxeDD/pcg-base: Basic 32/64 bit PCG random number generation in C.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

DDexxeDD/pcg-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PCG Random Number Generation, 32 and 64bit 2 file C Edition

This code is similar to the minimal c implementation, however it also includes basic 64bit and entropy functionality from the full implementation. Mostly this is a convenience library that condenses the basic entropy, 32bit, 64bit, and 32x2 64bit functionality from the canonical implementation in to 2 files.

For more information about PCG random number generation, check the PCG-Random website.

The 64bit implementation here uses the Double Xor Shift Multiply (dxsm) version, which was developed in 2019 and added to the canonical c++ implementation, but has not been added to the canonical c implementation.

Usage

There is no library to build, just drop pcg.h and pcg.c from the source folder into your project.

Check basic.c for the simplest usage example.

64bit, which requires a compiler with __uint128_t support, is enabled by default. If you do not want 64bit generators, or your compiler does not support __uint128_t (MSVC), you must define PCG_NO_128BIT.

Also included by default are 32x2 generators, which combine 2 32bit generators to acheive 64bit generation. If you do not want to build support for these you must define PCG_NO_32X2.

Building the demos

Building the demos will require meson and the ninja backend.

The 64bit and 32x2 demos can be disabled in the meson.build file by changing the build_64bit and build_32x2 variables.

meson setup build
meson compile -C build

This will create the build directory and put the executables in that directory.

License

Almost all of the implementation code is directly pulled from the canonical implementations and is released under the MIT License at my option :)

All of the demos except 'basic.c' retain the Apache 2.0 license which is included at the beginning of the file.

About

Basic 32/64 bit PCG random number generation in C.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0