Take the 2-minute tour ×  Thanks in advance for any help.  I
need to create random numbers which follow a user defined
function in Java. The general way of doing this is through
applying an uniform distribution to the integral of the
function. The thing is that I need to create the distribution of
functions which cannot be integrated or that the integral is
seriously complex or messy.  One example would be to generate
random numbers that would follow a distribution of the function:
f(x) = (cos(x))^1.5  Is there any math library in Java where you
can define a function and it returns random numbers? Any
recommendations?  Thanks a lot!  share|improve this question Can
you numerically approximate the CDF? –  Oli Charlesworth Jul 13
'12 at 18:05 Do you have a bit more info about the function? Do
you know the domain of definition of the function? Is it
bounded? –  GL770 Jul 13 '12 at 19:30 I was looking for a
general way of creating random numbers from user defined
funtions, the function I wrote is just one. Anywa