Actually, Harvard does look at the rank/class%, its at the top of its all-important evaluation form: Exact Rank: and % Rank:
https://www.wsj.com/articles/breakdown-of-the-harvard-admissions-process-1540287000
But regardless, you are right that it can appear pretty random, as the chance for an average high school is about 1/2000—for the average graduating class size of 200 that means one in ten years.