Implementing Beta distr.