Moved random implementations to random.js