Random number generator within range in mql5 - page 2

 
Keith Watford:

Why does this topic keep showing as having unread posts?

Is somebody constantly editing their post?

I do agree, it's very annoying to see this topic always at the top while nothing is added.

Please STOP that.

 
Alain Verleyen:

I do agree, it's very annoying to see this topic always at the top while nothing is added.

Please STOP that.

Somebody REALLY wants an answer to his/her question :)
 
Mladen Rakic:
Somebody REALLY wants an answer to his/her question :)

I appologize for that mistake. Really I did not know that would happen when I had to edit the code.

 
amrali:

I appologize for that mistake. Really I did not know that would happen when I had to edit the code.

If you edit a post then show it as edited by adding an "edit X" or a "PS". Otherwise it's very cumbersome for people reading this forum regularly.

By the way, good job here, very interesting this PCG thing.

PS: Are you planning to implement the full PCG library in mql ? :-D
 
amrali:

The above MathRandInt(function generates random integers in a uniform distribution (bias-free). It is enough to use it for general purposes.

Be aware that the following function commonly seen on this forum has a modulo bias. This can occur with some inputs when their range, b-a, is not dividing the whole range of the RNG evenly. It simply means that certain numbers are more likely to be drawn than others.

For more explanation on modulo bias, please refer to https://stackoverflow.com/a/738651/360211

PS: Here is a good reference about modulo-bias http://www.pcg-random.org/posts/bounded-rands.html for those who are interested.

Efficiently Generating a Number in a Range
  • 2018.07.22
  • M.E. O'Neill
  • www.pcg-random.org
The vast majority of my posts about random number generation have focused on looking at the properties of different generation schemes. But, perhaps surprisingly, the performance of your randomized algorithm may hinge not on the generation scheme you chose, but on other factors. In this post (inspired by and building on an excellent recent...
Reason: