If you need to generate beta distributed random numbers you could try
double inv_cumd_beta_stable(double a, double b, double y, double eps =
1.e-7);
and adjust the 1.e-7 as needed. It is in there to keep the function
from blowing up
in mixed models.