There are a number of possibilities. First, it is important to note that no two cases are exactly the same. Your friend's case may have additional facts that caused his case to be processed quicker. Second, USCIS often experiences delays in adjudication due to misplaced files, staffing shortages, or excess applications. Sometimes it is truly a matter of luck if your case is adjudicated more quickly than others.