Avoid NaNs in Beta distribution

Use the log form of the Beta function for generating the PDF for the
Beta distribution to avoid NaNs for large parameter values.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>