In Saudi Arabia's case, the legal system does appear to be arbitrary.
> The primary source of law is the Islamic Sharia derived from the teachings of the Qur'an and the Sunnah (the traditions of the Prophet). Saudi Arabia is unique among modern Muslim states in that Sharia is not codified and there is no system of judicial precedent, giving judges the power to use independent legal reasoning to make a decision. Saudi judges tend to follow the principles of the Hanbali school of jurisprudence (fiqh) found in pre-modern texts and noted for its literalist interpretation of the Qur'an and hadith.
> Because the judge is empowered to disregard previous judgments (either his own or of other judges) and may apply his personal interpretation of Sharia to any particular case, divergent judgments arise even in apparently identical cases, making predictability of legal interpretation difficult.
[0]: https://en.wikipedia.org/wiki/Saudi_Arabia#Legal_system