![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
That is NOT how William is using the modulus function in the example in his link. He is using modulus for the range max calculation, not against the random number generator itself.
EDIT: Correction ... Actually he is using the modulus function against the generator, but only after the filter (aka the while loop).
Fernando Carreiro #: Assuming a uniformly distributed random number generator, then the modulus alternative will also be uniformly distributed.
If you had looked at the link provided, the code handles the fact that 32767 is not a multiple of 1000 and gives a uniformly distributed result using modulo.