
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Can you please explain or give a reference for your claim (I asked u this before -> https://www.mql5.com/en/forum/125208, u probably didn't notice it).
http://www.fourmilab.ch/random/
I've tried their ent.exe application on 500,000 samples of the low-order bytes from the MT4 random number generator, and I consistently get chi-squared percentages in the range 5-95 which they describe as not suspect. All the other measures (arithmetic mean etc) also look random.
On this basis, I think your "Never, EVER, use the low bits of random numbers" is wrong with regard to MT4.
Example output as follows:
Never, EVER, use the low bits of random numbers, they are very NON-RANDOM. Initialize the random generator ONLY once.
Wouldn't MathRand()/32767.0 produce aRand 0 to 1.0?
That's how I do it.
http://lmgtfy.com/?q=low+bits+on+random+numbers+are+nonrandom yields among many http://www.fourmilab.ch/random/ which states:
This seems to depend on the specific random generator implementation (language, compiler, etc.)... There's no general rule here and jjc's test suggests that it's not necessarily as bad in MQL4.
^ I concur with gordon's surmising...after reviewing a handful of links provided by that google query the conclusion appears to be that one should be wary of the randomness of any given pseudo-random generator until it is determined to be sufficiently random.
The link pursued and examined by jjc provides the tools necessary to analyze and determine if one's pseudo-random generator is sufficiently random.
jjc's subsequent analyses of MT4's pseudo-random generator would appear to conclude that it is in fact sufficiently random and that one can use the lower bits with confidence.
WHRoeder do you not concur with this line of reasoning? If you do not concur can you please explain (assist us in understanding) where the discrepancy lies?
jjc's subsequent analyses of MT4's pseudo-random generator would appear to conclude that it is in fact sufficiently random and that one can use the lower bits with confidence.
On subsequent runs of the code I have seen a few percentages in the 0-1 and 99-100 range, but the random number generation does look generally sound.
And if there were a problem with it, something like MathRand()/32768 wouldn't be the answer; that would obviously give you values unevenly spread (or spread in predictable bands) between zero and one. In addition, the page at www.fourmilab.ch isn't saying "don't use the lower bits". It's saying that the Unix random number generator is flawed in toto, with the slight possibility that they've only tested the low byte and that you therefore might possibly be able to get away with doing something like rand() >> 8.
jjc's subsequent analyses of MT4's pseudo-random generator [...]
FYI, my test script for generating input into ent.exe goes like this:
FYI, my test script for generating input into ent.exe goes like this:
THANKS!!
This was on my to-do list (making code like this) after reading your post original post on the matter way above, saves me a bit'o time.
Wouldn't MathRand()/32767.0 produce aRand 0 to 1.0?
While true, normally you don't want that.
A random int from 0-9 would be int(10*MathRand()/32768.0)
if you used 32767 then you would still get a random 0-9 except one time out of 32767 you'd get a 10.