... s'il n’avait pas découvert cet objet au hasard de ses recherches.
The locution « au hasard » is about "randomness" while the locution « par hasard » is about "unintentionally, by chance".
But I wonder if « au hasard de ... » has the meaning of "unintentionally, by chance (during his researches)", and is therefore closer in meaning to « par hasard » than to « au hasard » ?