I need a formula that returns a value representative of the amount of ‘assortment’ a group shows. The groups are made up of individuals, all of a binary class (e.g. male or female), are of difference sizes, and can be from different populations (i.e. different ratio of males to females). I have thought of the logical rules and examples for this, but am having difficulty formulising it properly, despite extensive attempts using binomial probabilities. I think the best way to explain is give some examples, of some groups, and which would rank the highest in ‘assortment’:

e.g. In a population with equal ratio of males:females

GROUP-A = 1Male & 1Female
GROUP-B = 2M & 0F
G-C = 0M & 2F
G-A is the most ‘dissassorted’ whilst G-B and G-C are equally assorted

G-D = 5M & 0F
G-D is more assorted than both G-B, and G-C, as the probability of getting 5 males in a group of 5 is much lower than 2/2

Now, consider some groups from a population of with 9 males to each females
G-E = 5M & 0F
G-F = 5M & 5F

G-E demonstrates less assortment that G-D, as chances of getting 5M 0F is much higher when chance of male occurrence is 0.9 (i.e. 9:1 M:F)
G-G demonstrates much more ‘assortment’ than G-F (or G-B or G-C), as the chances of getting 5F at with 0.1 chance of getting each female (even in a group of 10 individuals), is very low.

Therefore, a need a measure that would give a value of assortment for any given group, and would make sense that the more ‘assorted’ a group is, and the reduced likelihood of getting it, the higher the value is.
I have tried lots of things with binomial probabilities, and one of the main problems with my best attempts is that a group with no actual assortment (e.g. 1M & 1F) could score higher than a group which potentially displays assortment (e.g. 2M & 0F) if , for example, the chance of a female occurring is very low.