Create separate file for this please: random.js or similar and move this logic there.