Generally speaking, it is not allowed, but it may also be because of unreasonable reasons, such as uneven personnel, nervous dormitory, etc., people of different majors will be mixed together, but they are generally separated.
Some universities are mixed students, and some universities are open enough to apply for sharing with whom. Well, according to your school situation.
However, I think living with a major may better promote learning.