Refactor random exercise