By batches i think you are implying to sections
If so then, the sections are decided randomly no such sorting scheme is present. Many a times one or two sections consist more high rank holding students compared to others
but yes, each section contains almost the same amount of students from specific branches so more or less there is a harmony.
hope this helps 🙂