Fix integer generator to generate uniform numbers #46

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@Motiejus
Contributor

?RANDOM:uniform(0, Number) is sufficient for random number generation.

This fixes random number generation case:
http://erlang.org/pipermail/erlang-questions/2012-September/069104.html

@Motiejus Motiejus Fix integer generator to generate uniform numbers
?RANDOM:uniform(0, Number) is sufficient for random number generation.
1950c8a
@kostis
Collaborator
kostis commented Feb 19, 2013

First of all, apologies for the delay in reacting on this one.

We are not going to merge this pull request. The generation of random integers in PropEr cannot be totally random. It needs to be skewed so that it generates "several small numbers, including 0", "the same number more than once", "some numbers that are likely to be boundaries, e.g. close to byte()-end", etc.

However, you raise a valid point in your mail(*) reporting that the range you get is perhaps not the one you would have expected. We should look into this issue, but its solution is not the one this pull request proposes. (Actually, you should have expected that because if it were so simple we would not have spent the extra effort to write the generator that currently exists in PropEr's code base.)

(*) The pointer to your original mail in your pull request is the wrong one, at least now that I write this...

@kostis kostis closed this Feb 19, 2013
@Motiejus
Contributor

Yes, indeed I realized it when I used it. The range has to be skewed towards 0 at least. Thanks for feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment