Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

LCG Parameter Analysis

A C implementation of several utilities for working with Linear Congruential Generators (LCGs), one of the simplest and historically important classes of pseudo-random number generators.

The project explores the mathematical properties of LCGs and provides tools for generating sequences and analyzing generator parameters.

Overview

A linear congruential generator produces a sequence according to the recurrence relation

Xₙ₊₁ = (aXₙ + c) mod m

where:

  • X₀ — initial seed
  • a — multiplier
  • c — increment
  • m — modulus

The quality and period of the generated sequence strongly depend on the chosen parameters.

Features

  • Generation of pseudo-random sequences using an LCG
  • Search for valid multiplier coefficients
  • Search for valid increment coefficients
  • Basic number-theoretic utilities used in parameter analysis
  • Reading commands from an input file and writing results to an output file

Purpose

This project was developed as an educational exercise focused on:

  • pseudo-random number generation;
  • linear congruential generators;
  • elementary number theory;
  • implementation of mathematical algorithms in C.

Build

gcc main.c -o lcg

Usage

The program processes commands from an input file and writes results to an output file.

Example tasks include:

  • generating an LCG sequence;
  • finding suitable generator parameters;
  • testing mathematical conditions related to generator periods.

Limitations

This project is intended for educational purposes and does not aim to provide a production-quality random number generator.

References

  • Donald E. Knuth, The Art of Computer Programming, Volume 2: Seminumerical Algorithms
  • Hull, T. E., Dobell, A. R. "Random Number Generators"
  • Numerical Recipes

About

Utilities for generating and analyzing Linear Congruential Generator (LCG) parameters in C.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages