Au hasard and par hasard are two different expressions. They both relate to chance, but their meanings are not the same.
Au hasard
Au hasard means: without choosing, without thinking.
- Je choisis un livre au hasard. (I choose a book at random.)
- Il répond au hasard. (He answers randomly.)
- Elle prend un numéro au hasard. (She takes a number at random.)
Par hasard
Par hasard means: by chance or without intention.
- Je l’ai vu par hasard dans la rue. (I saw him by chance in the street.)
- Tu n’aurais pas un stylo, par hasard ? (You wouldn’t happen to have a pen, by any chance?)
- Nous sommes arrivés là par hasard. (We arrived there by chance.)
Compare
- Je prends un bus au hasard. → je ne choisis pas (I take a random bus → I don’t choose.)
- Je rencontre Paul par hasard. → ce n’est pas prévu (I meet Paul by chance → it is not planned.)
- Elle ouvre une page au hasard. → sans réfléchir (She opens a page at random → without thinking.)
- Il trouve ce café par hasard. → par chance (He finds this café by chance → by luck.)
Simple difference
- Au hasard → action without choice
- Par hasard → unplanned situation