Linear Congruential Generator

Rigatoni

Redeemed Resident Italian
Site Supporter
Jan 25, 2014
3,922
6,018
Southern U.S.
✟222,009.00
Country
United States
Faith
Non-Denom
Marital Status
Single
Just a thread to experiment with Linear Congruential Generation (and to increase my post count ^_^). :study: I use this algorithm a lot when scripting, and in general I enjoy crunching numbers. It's used to simulate randomness, such as in computer graphics and other fields. The equation for this thread is based on the LCG method, and is as follows:

result = ((a * (x + s) + i) % ma) % mb

a is the multiplier (used to significantly increase the input value)
x is the input integer
s is the seed added to the input (in this case, the current date as an integer, i.e.: 10232019)
i is the increment (used to further increase the input value)
m is the modulus, or remainder of division (used to "wrap" the output within a certain, predicted range)

x will start as 0, and will gradually increase by 1 for each succeeding post. The resultant value will be posted in each message, along with the input and equation values. Anyone else is welcome to join in and try to solve it if they wish - fellow number-crunching enthusiasts are welcome. a, s, i and m values can change, but the original post will be updated to reflect any changes.

Initial input and equation values:
a: 10152463
x: 0
s: 10232019
i: 67937503
ma: 100000007
mb: 64
 
Last edited:

Rigatoni

Redeemed Resident Italian
Site Supporter
Jan 25, 2014
3,922
6,018
Southern U.S.
✟222,009.00
Country
United States
Faith
Non-Denom
Marital Status
Single
(slightly modified the algorithm above)

((10152463 * (2 + 10232019) + 67937503) % 100000007) % 64

> ((10152463 *10232021 + 67937503) % 100000007) % 64
> ((103880214617723 + 67937503) % 100000007) % 64
> (103880282555226 % 100000007) % 64
> 75283612 % 64
> 28
 
Upvote 0

Rigatoni

Redeemed Resident Italian
Site Supporter
Jan 25, 2014
3,922
6,018
Southern U.S.
✟222,009.00
Country
United States
Faith
Non-Denom
Marital Status
Single
(Decided to keep the seed consistent, to better gauge the sequence of output values.....and because I forgot to update it last time)

((10152463 * (3 + 10232019) + 67937503) % 100000007) % 64

> ((10152463 * 10232022 + 67937503) % 100000007) % 64
> ((103880224770186 + 67937503) % 100000007) % 64
> (103880292707689 % 100000007) % 64
> 85436075 % 64
> 43
 
Upvote 0