Well consider I have a uniform random number generator. How would I craft a function which takes as parameter this RNG, such that the distribution is following a given function?
Or more to the point: I have a a function $f(x) = 0.75-0.75x^2$ (and outside the interval $[-1, 1]$ it is $0$. This function represents the distribution I wish to gain.
Now as the integral represents the chance a number is between two boundaries, I could integrate above function between $[-1, X]$ and this value would then represent the "RNG(x)". Doing so:
$$\int_{-1}^X 0.75 -0.75x^2 dx = 2 \cdot \mathrm{RNG}(x) - 0.5$$ $\mathrm{RNG}(X)$ gives a number between $[0, 1]$ so I convert it also to the correct $$-0.25X^3 + 0.75X - 0.5 = 2 \cdot \mathrm{RNG}(x) - 0.5$$
However this is an unsolvable equation? How would I make a RNG with said distribution?
This is not unsolvable in the strictest sense, but a different approach may be appropriate for $f$ with support $[a,b]$ and maximum $c$:
This is especially nice if $f$ differs only slightly from a uniform distribution. Alternatively, this rejection method can also be refined if one can generate $(u,v)$ uniformly in another shape that approximates the graph of $f$. The simplest refinement would be to split the ractnagle $[a,b]\times[0,c]$ into several smaller rectangles or trapezoids.