Force scipy.stats.cauchy between an interval
Short answer: Not directly, no.
The issue is that a distribution is normalized, the integral of the pdf over the support is unity. When you change the support, you are effectively changing the distribution.
For the truncated Cauchy distribution, you can easily roll your own little generator, using the inverse function transform of a uniform random variate.
I would like to force scipy.stats.cauchy probability density function to only generate values between -1 and 1.
Currently I am doing the hacky way by running y=cauchy.rvs(center,sigma) inside a while loop and while its lower than -1 or higher than 1 it recomputes it and after it enters the desired interval it returns y. So essentially I am drawing a new random variable until the conditions are not met.
I am wondering whether it's possible to do this in a simpler way, the scipy documentation is not very helpful and it's very ambiguous. Is there any way to specify the min/max range of the random variables inside the function arguments, like via **kwargs or something?