In law a riot is “a violent disturbance of the public peace by twelve or more persons assembled for a common purpose” and may be committed in private as well as public places.
The Riot Act, which carried real weight and is the one we still refer to in the expression, became law in England in 1714.
It authorized the death penalty for those who failed to disperse after the act had been formally read to those assembled.
Thankfully, there have been modern revisions to that act, though the consequences to those who disobey the order to disband can still be severe.
We often threaten to read the “riot act” to discipline children.