Algebra Solver

I have a new probability model whose cdf is
cdf = 1/(1- exp(-lambda))*(1.0 - exp(-lambda * (1-exp(-beta/q)) * exp(-alpha*exp(-beta/q)))) and I would like to generate random numbers using quantile function of that cdf but it is nonlinear to find quantile function. Is there any other option to generate random numbers instead of quantile function? I have tried to use the algebra solver function of stan but could not, I have converted cdf to this form to obtain the quantile function as stan manual.

log(1 - exp(-beta/x)) - alpha * exp(-beta/x) - log(1-z) = 0,
where z = 1+(1/lambda) * log(1-(1-exp(-lambda))*(1-p))
how to solve this equation for x and generate rng in stan. where alpha, beta, lambda are parameters and p - uniform (0,1)
please help me this needed for PPC.