I want to generate a random real number between 0 and 1 but not distributed uniformly but with a probability distribution say, 2 Sin[ pi x ]^2
which integrates to 1 and peaks at $x = 1/2$.
I tried looking for Biased random variables in the HELP tab, but it did not show any hits.
This is my PDF:
pdf = 2 Sin[Pi x]^2
RandomVariate
of aProbabilityDistribution
with your chosen PDF function? $\endgroup$"Mathematica" How do you generate a random number with a pre-specified probability distribution?
(i.e the title you wrote) the first hit brings me to Random Number Generation, which contain in the second paragraph already an explicit mention ofRandomVariate
, which could have been a good start. $\endgroup$