Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix integer generator to generate uniform numbers #46

Closed
wants to merge 1 commit into from
Closed

Fix integer generator to generate uniform numbers #46

wants to merge 1 commit into from

Conversation

motiejus
Copy link
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

?RANDOM:uniform(0, Number) is sufficient for random number generation.
@kostis
Copy link
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
Copy link
Contributor Author

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants