Fix bug in random.js