I need to sample from the generalized beta of the second kind (GB2) distribution (McDonald, 1984, Econometrica). Its PDF has the form $$ f_{a,b,p,q}(x) = \frac{|a|x^{ap-1}}{b^{ap}B(p,q)(1+(x/b)^a)^{p+q}}. $$ Its CDF does not have a closed form, so I cannot use an inverse transform method. Does anyone know how to sample from this distribution or know of a Fortran random number generator library that contains this distribution?
None of the packages in the netlib.org/random library contain the GB2.