In the book Nefesh Harav (P135) the following is recorded.
There is a hierarchy established in Halacha to determine who, of a number of vying congregants, has the right to read the Kaddish prayer to honour and commemorate a relative who has passed on. This hierarchy is recorded by the Magen Avraham, a most celebrated commentator of the Shulchan Aruch.
The ShaAgas Aryeh was approached to resolve a dispute that had arisen between congregants who both claimed that according to the established hierarchy each one should be granted the privilege of reciting the Kaddish. He directed them to draw lots.
One of the combatants questioned this method; "Surely this is not the way Halacha is determined. There must be some type of investigation, analysis and proof brought to show which of us has the priority over the other."
The Shaagas Aryeh asked in response, "And how do you think that this particular sequence was established in the first place?" "Well, we are just following the same procedure that the Magen Avraham used to establish the hierarchy that he recorded."
I feel confident in proposing that he did not mean it was a totally random arrangement, certainly some priorities are self evident or clearly determined from priorities observed in Halacha; nevertheless it was clear to him that some arrangements were simply established because they were arbitrarily so chosen.
Rabbi Y. B. Soloveitchik would quote this story to illustrate that Halacha does not necessarily have a definitive opinion about all things that can be determined through Halachic analysis.