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

Motiejus Jakštys <>
Wed Sep 12 10:27:21 CEST 2012


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



More information about the erlang-questions mailing list