ericzhang-cn/random.js — pull request #1 by colesbury (2013-07-29 18:44:31+00:00)
Title: Fix beta distribution when v < w and min, max != 0, 1.

The beta distribution is incorrect when v < w.

The (max - min) expression already scales the result of the recursive call to the beta function.

Here's the code from http://ftp.arl.mil/random/random.pdf:

if ( v < w ) return xMax - ( xMax - xMin ) * beta( w, v );

Note that the recursive call to beta(w, v) doesn't include the scaling parameters.