Skip to content

integer generator can't generate very large integers #82

puzza007 opened this Issue Feb 11, 2014 · 1 comment

2 participants


Because it uses floats, it seems.

1> proper_gen:integer_gen(1, -(1 bsl 2000), 1 bsl 2000).
** exception error: an error occurred when evaluating an arithmetic expression
     in function  random:uniform/1 (random.erl, line 112)
     in call from proper_arith:rand_int/2 (src/proper_arith.erl, line 242)


-spec rand_int(integer(), integer()) -> integer().
rand_int(Low, High) when is_integer(Low), is_integer(High), Low =< High ->
    Low + random:uniform(High - Low + 1) - 1.
kostis commented Feb 11, 2014

I consider this to be actually a bug in random:uniform/1 instead of PropEr.

Let's see what the people at the erlang-bugs mailing list have to say about it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.