Java: Generate Random Numbers following a user defined Function
===

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!