A port of Chance.js to PHP