Refactor /random/ to return a JSON object.