Probability of Random Groups being split by Gender I was teaching a class today that had 13 students: 8 male and 5 female. I went to a random team maker website to split the 13 students into 5 groups (3, 3, 3, 2, 2). After I entered the info on the website and hit the randomize button, it spit out the random groups and students moved into their groups and started the activity. As I looked around at the groups, I realized the groups were completely gendered: 3 males, 3 males, 3 females, 2 males, 2 females. That got me thinking, what is the probability of that happening? Here's my calculation:
$\dfrac{{8 \choose 3}{5 \choose 3} {2 \choose 2}{5\choose3}{2\choose2}}{{13\choose3}{10 \choose 3}{7 \choose 3}{4 \choose 2}{2 \choose 2}}$
I don't think I need to multiply by the ${5\choose3}{2\choose2}$ in the numerator since after you choose all the groups of the boys, then the girls have to be split into groups of 3 and 2 at that point.
Anyways, I put that calculation into Wolfram Alpha and it returned a value of $\frac{1}{1287}$, so I'm thinking it's more likely that I just don't know how to calculate this right, since I'm not great at counting/combinatorics. Any insight is appreciated!
 A: Your expression would correctly answer the following, which I'll call Question A:

I have five distinguishable groups: A, B, C, D, and E, which require 3, 3, 2, 3, and 2 members, respectively. There are 8 males and 5 females in my class; what is the probability that groups A, B, C would consist entirely of the 8 males (and groups D, E of the females)?

Equivalently, you could just ask about the probability that a given collection of 8 randomly-selected students happening to be the 8 males. This is much more straightforward to compute, out of the $\binom {13}{8} = 1,287$ ways to choose 8 members of the class, just one has the desired proprty.
However, this is lower than the probability in your question. Notice that your condition would have been fulfilled not only by groups A, B, C consisting only of male members of the class -- but also if the males comprise all of groups A, B, E (trading one group of size two for the other).
The task now is to count the number of configurations that fulfill the desired property, all of which have the same probability as the one you found. We could list them out directly, or we could do a quick combinatorial sub-problem; we need to choose two of the groups of size 3 that will contain only male members, and choose one group of size two. The number of ways to do this is $\binom 3 2 \cdot \binom 2 1 = 6$, so the true probability should have been $\fbox{$\frac{6}{1287}$} \approx 0.00466.$ So, yes -- the thing you saw was relatively rare -- it should happen about 1 time out of every 200.

I sometimes like to support combinatorial arguments like this with Monte Carlo simulations. Here are two simulations in R to verify this work:
Simulation for Question A:
my_class <- c(rep("M", 8), rep("F", 5)) # vector of class gender composition

distinguishable_groups <- function(){
  group_assignment <- sample(my_class)  # gives full rearrangement of my_class
  all(group_assignment[1:8] == "M")     # check whether first 8 are all M
}

set.seed(3528)                          # ensures reproducible results
mean(replicate(1e6, distinguishable_groups()))

This gives a simulated probability of 0.000736, which is close to $1/1287 \approx 0.0007770008$.
Simulation for your question:
This is not the best way to write this from a coding perspective, but my primary goal is to show that I'm not cheating or burying any combinatorial nuances under the rug.
Like above, we rearrange the my_class vector -- but here, we just divide them directly into groups of the requisite size, then check whether each group has just one unique gender among its members.
original_question <- function(){
  group_assignment <- sample(my_class)
  length(unique(group_assignment[1:3])) == 1 &     # group A
    length(unique(group_assignment[4:6])) == 1 &   # group B
    length(unique(group_assignment[7:9])) == 1 &   # group C
    length(unique(group_assignment[10:11])) == 1 & # group D
    length(unique(group_assignment[12:13])) == 1   # group E
}

set.seed(3528)                          
mean(replicate(1e6, original_question()))

This gives an output of 0.004608, which is quite close to $6/1287 \approx 0.004662005$.
