Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Linear Congruent Random Number Generator Model Documents

This material has 2 associated documents. Select a document title to view a document's information.

Main Document

Linear Congruent Number Generator 

written by Wolfgang Christian

The Linear Congruent Random Number Generator Model generates a sequence of integers x[i] over the interval [0, m-1] by the recurrence relation

x[i+1] = (a*x[i]+c) mod m

where the modulus m is greater than zero, the multiplier a is greater than zero and less than m, and the increment c is greater than zero and less than m. All numbers are integers and all arithmetic is integer arithmetic. The initial value x[0] is known as the seed.

The Linear Congruent Number Generator Model was created using the Easy Java Simulations (EJS) modeling tool.  It is distributed as a ready-to-run (compiled) Java archive.  Double clicking the ejs_math_RandomLCG.jar file will run the program if Java is installed.

Published December 16, 2008
Last Modified June 10, 2014

This file has previous versions.

Source Code Documents

Linear Congruent Number Generator source code. 

The source code zip archive contains an XML representation of the EJS Linear Congruent Number Generator Model.   Unzip this archive in your Ejs workspace to compile and run this model using Ejs.

Last Modified June 17, 2010

This file has previous versions.

The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics