Make sure you know what the support of the f(x) is first, and check that it is a pdf, then look at:
Inverse transform sampling!
It might be easier to use rejection sampling though for this pdf
CB
I am interested to find out:
I want use where is drawn from (a density defined from 0<x<1).
The question is simple. How can I draw a random sample of let say 10000 from the density ?
What I did is to generate 10000 random uniform variable and subst into the equation.
For example:
x=runif(10000)
g=3(1-x^2)/2
but the answer is still wrong after computation
Meanwhile finding this inverse is hard
Make sure you know what the support of the f(x) is first, and check that it is a pdf, then look at:
Inverse transform sampling!
It might be easier to use rejection sampling though for this pdf
CB