0

linear congruential number generator values

Kind of a hard question. I am playing a little with this number generator: function randomnumber(){ var newrandom = (oldrandom*a+c)%m; oldrandom=newrandom; return newrandom; } this is a random number generator, kind of like Math.random(), but i was interested in the math so... now my "problem" is i'm playing with the values a, b and m, and watching the results, i know some values are better than others. Can someone point me to a good article or a value chart about this? I tried looking for it but not very good articles come up

17th Mar 2021, 9:07 PM
Pablo Sosa
Pablo Sosa - avatar
6 odpowiedzi
0
a and c are undefined. what are they? what language are you using?
18th Mar 2021, 2:41 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
0
Sry i didn't explain that part, a,c and m are whatever you want, and if you lets say set it like a=50; c=96; m=200; it will work just fine, but mathematicaly some values work better than others, i'm looking for those values. I'm working on javascript but this can be used in any language, it's just a math problem
18th Mar 2021, 4:44 PM
Pablo Sosa
Pablo Sosa - avatar
0
are you asking for a good random formula?
18th Mar 2021, 4:48 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
0
YES, good but not too complex, just to give random integers from 0 to 100 or so
19th Mar 2021, 10:13 AM
Pablo Sosa
Pablo Sosa - avatar
0
this seems like reinventing the wheel. you want to not use the main system random module, but then you’re asking other people for formulas, and most people will probably end up just giving you the formula that your language already has well implemented.
19th Mar 2021, 12:21 PM
Wilbur Jaywright
Wilbur Jaywright - avatar
0
It is also for learning purposes
19th Mar 2021, 2:07 PM
Pablo Sosa
Pablo Sosa - avatar