What would be the easest way to generate classes(school) will a somewhat equal number of boys and girls. the information for that is comming from a data base.
with a program.
without knowing what type of information you will be retrieving and how much you wish to use it is not possible to be more specific.
If I understand what you want to do correctly: if you have some way of knowing what gender each student is, then you can keep a list of boys and a list of girls. As each student's information is read in search the list of all the students in each of the classes for the class for the shortest list of students of the appropriate gender. Add the current student to the appropriate list of the appropriate class.