[erlang-questions] PropEr: integer/2 not generating numbers uniformly

15 views
Skip to first unread message

Motiejus Jakštys

unread,
Sep 12, 2012, 4:27:21 AM9/12/12
to pro...@softlab.ntua.gr, erlang-q...@erlang.org
Hi,

?FORALL(
I,
integer(- 1 bsl 100, 1 bsl 100),
begin
Pid ! {instance, I},
true
end
).

collect() ->
collects all numbers, computes min/max and displays them.

I am expecting numbers distributed between
-1267650600228229401496703205376 to 1267650600228229401496703205376.

For 10k tests:
Min: -1135, Max: 761
Min: -2254, Max: 2506
Min: -1510, Max: 734
Min: -955, Max: 1669
Min: -1531, Max: 902

For 100k tests:
Min: -2895, Max: 5668
Min: -2479, Max: 5553
Min: -6423, Max: 2378

Is there a fundamental reason for this behaviour? What would be best
way to create a generator that spans much wider ranges?

Thanks,
Motiejus Jakštys
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Motiejus Jakštys

unread,
Sep 12, 2012, 5:37:42 AM9/12/12
to pro...@softlab.ntua.gr, erlang-q...@erlang.org
On Wed, Sep 12, 2012 at 10:27 AM, Motiejus Jakštys
<desir...@gmail.com> wrote:
> Is there a fundamental reason for this behaviour? What would be best
> way to create a generator that spans much wider ranges?
>

Seems like a bug in random number generator in PropEr. I submitted a
pull request:
https://github.com/manopapad/proper/pull/46

--

Reply all
Reply to author
Forward
0 new messages