• Welcome to Christian Forums
  1. Welcome to Christian Forums, a forum to discuss Christianity in a friendly surrounding.

    Your voice is missing! You will need to register to be able to join in fellowship with Christians all over the world.

    We hope to see you as a part of our community soon and God Bless!

  2. The forums in the Christian Congregations category are now open only to Christian members. Please review our current Faith Groups list for information on which faith groups are considered to be Christian faiths. Christian members please remember to read the Statement of Purpose threads for each forum within Christian Congregations before posting in the forum.
  3. Please note there is a new rule regarding the posting of videos. It reads, "Post a summary of the videos you post . An exception can be made for music videos.". Unless you are simply sharing music, please post a summary, or the gist, of the video you wish to share.

Linear Congruential Generator

Discussion in 'Number Games' started by Anthony7, Oct 23, 2019.

  1. Anthony7

    Anthony7 Rigatoni

    +4,782
    United States
    Non-Denom
    Single
    US-Others
    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: Oct 25, 2019
    We teamed up with Faith Counseling. Can they help you today?
  2. Anthony7

    Anthony7 Rigatoni

    +4,782
    United States
    Non-Denom
    Single
    US-Others
    (10152463 * (0 + 10232019) + 67937503) % 100000007

    > (103880194312797 + 67937503) % 100000007
    > 103880262250300 % 100000007
    > 54978686
     
  3. Anthony7

    Anthony7 Rigatoni

    +4,782
    United States
    Non-Denom
    Single
    US-Others
    (10152463 * (1 + 10232019) + 67937503) % 100000007

    > (10152463 * 10232020 + 67937503) % 100000007
    > (103880204465260 + 67937503) % 100000007
    > 103880272402763 % 100000007
    > 65131149
     
  4. Anthony7

    Anthony7 Rigatoni

    +4,782
    United States
    Non-Denom
    Single
    US-Others
    (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
     
  5. Anthony7

    Anthony7 Rigatoni

    +4,782
    United States
    Non-Denom
    Single
    US-Others
    (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
     
Loading...