Context-Free Grammars and Random Number Generation

In Monte Carlo calculations, one often needs to generate a random quantity X that satisfies certain (cumulative) distribution function F(x), i.e. Pr{X ≤ x} = F(x). Numerous methods have been proposed for this purpose (see Ahrens and Dieter [1], Knuth [4]). An interesting question is: for a given F(x), how difficult is it to generate this distribution?