Giter VIP home page Giter VIP logo

lcg-toolkit's Introduction

Linear Congruential Generator Toolkit

Simulator and plotter for linear congruential generator (LCG) functions in Python 3 with MatPlotLib.

This was made for academic purposes, to study the function of linear congruential generations and specifically the famed RANDU LCG function.

Usage

To run as the generator is currently set, just run python lcg.py (python3 lcg.py on Mac).
This will simulate RANGE_END-RANGE_START generations and plot them with a MatPlotLib display.
To change the LCG parameters, set them in the top of lcg.py:

# SEED VALUE
# RANDOM NUMBER = randint(1, 0x7FFFFFFF)
X0 = randint(1, 0x7FFFFFFF)

RANGE_START = 0
RANGE_END = 500

# MULTIPLICATIVE FACTOR
A = 1664525

# ADDITIVE FACTOR
C = 1013904223

# MODULUS FACTOR
M = 2**32

The LCG function is expressed as X(i+1) = ((A*X(i)) + C) mod M.

Copyright

lcg-toolkit is copyright © 2021 Jackson Rakena under the MIT License.
You are free to use this in your academic papers or projects, but please include a credit and link to this repository.

lcg-toolkit's People

Contributors

jacksonrakena avatar

Watchers

 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.