This is very nice. I’m going to add this example to the manual after a bit of renaming and collapsing:
real weibull_lb_rng(real alpha, real sigma, real lb) {
real p = weibull_cdf(lb, alpha, sigma); // cdf for bounds
real u = uniform_rng(p, 1);
return sigma * (-log1m(u))^(1 / alpha); // inverse cdf for value
}
Here’s the issue comment