Fixed numerous errors in random.js