Beta Distribution in Javascript