Equivalent javascript code:
var randEntry, randIndex, randUpTo, _ref;
window._d = window.d = (_ref = typeof console !== "undefined" && console !== null ? console.log.bind(console) : void 0) != null ? _ref : function() {};
randUpTo = function(num) {
return ~~(num * Math.random());
};
randIndex = function(arr) {
return randUpTo(arr.length);
};
randEntry = function(arr) {
return arr[randIndex(arr)];
};
d3.text('data/aphorisms.txt', function(err, text) {
var db, generate, i, lineIndex, lines, token, tokens, tokensByLine, wordsByLine, _i, _j, _k, _len, _len1, _results;