Inconsistent behaviour of `truncate` for discrete distributions
When truncating a Geometric distributions, rand will return different types depending on the bounds chosen. For example, values sampled from truncated(Geometric(0.6); lower = 2) are floats, while values sampled from truncated(Geometric(0.6); upper = 4) are integers.
I guess this is due to https://github.com/JuliaStats/Distributions.jl/blob/7e232ca86c56c4b2e1e7a44b16aa23c26668af3d/src/truncate.jl#L211-L229 using the float-returning quantile / invlogcdf in special cases.
I think the problem are actually quantile and invlogcdf here. For Geometric they should always return an Int. For other distributions (and in particular discrete distributions) typically we ensure that the return type of quantile etc. and the type of the variates match. For instance, for discrete distributions where such calculations are performed with StatsFuns/Rmath we explicitly convert the result to Int.