Organizing the gatekeepers of the Temple required a system that was both orderly and completely fair. To determine the exact placement of guards throughout the Temple Mount, a lottery was held among the twenty-four heads of the guard shifts [מלבי״ם]. This selection process was entirely equal. Younger or less prominent family members held the exact same standing as their older, more distinguished relatives [מצודת דוד, ביאור שטיינזלץ]. Everyone was counted together to ensure each shift had the required number of guards [רלב״ג].
While other groups serving in the Temple, such as the priests and the singers, also used lotteries, their draws were designed to establish the schedule and chronological order of their shifts. For the gatekeepers, however, the lottery served a purely geographic purpose, determining only their physical stations [רד״ק, מצודת דוד]. The draw decided exactly who would be assigned to each specific gate, which direction they would face—east, west, north, or south—and where they would stand at the other gates within the courtyard [רש״י, רד״ק]. In total, the guards were distributed across twenty-four distinct posts, spread out across all four directions of the Temple complex [רלב״ג].