GithubHelp home page GithubHelp logo

pcg-c-basic's Introduction

PCG Random Number Generation, Minimal C Edition

This code provides a minimal implementation of one member of the PCG family of random number generators, which are fast, statistically excellent, and offer a number of useful features.

Full details can be found at the PCG-Random website. This version of the code provides a single family member and skips some useful features (such as jump-ahead/jump-back) -- if you want a more full-featured library, you may prefer the full version of the C library, or for all features, the C++ library.

Documentation and Examples

Visit PCG-Random website for information on how to use this library, or look at the sample code -- hopefully it should be fairly self explanatory.

Building

There is no library to build. Just use the code. You can however build the three demo programs.

The code is written in C89-style C with no significant platform dependencies. On a Unix-style system (e.g., Linux, Mac OS X), or any system with make, you should be able to just type type

make

Almost all the real code is in pcg_basic.c, with type and function declarations in pcg_basic.h.

On other systems, it should be straightforward to build. For example, you even run the code directly using the tinycc compiler, using

cat pcg_basic.c pcg32-demo.c | tcc -run

Testing

This command will build the three provided demo programs, pcg32-global-demo (which uses the global rng), pcg32-demo (which uses a local generator), and pcg32x2-demo (which gangs together two generators, showing the usefulness of creating multiple generators).

To run the demos using a fixed seed (same output every time), run

./pcg32-demo

To produce different output, run

./pcg32-demo -r

You can also pass an integer count to specify how may rounds of output you would like.

pcg-c-basic's People

Contributors

imneme avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.