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
6 Antworten
0
a and c are undefined. what are they?
what language are you using?
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
0
are you asking for a good random formula?
0
YES, good but not too complex, just to give random integers from 0 to 100 or so
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.
0
It is also for learning purposes