Given $N$ distinct numbers, $n$ persons each picks $x_i > 0$ numbers, what is the probability $P$ of them all picking different numbers?
The limiting case of $n > N$ is trivial, $P = 0$. Same for $\sum_{i=1}^n x_i > N$.
This question was inspired by an online ice-breaking event with new colleagues. Every person ($n = 6$) listed their interests ($x_i \approx 4$), and surprisingly there were zero match. Naturally some interests may be more popular than others, but I will leave it for now.
I wrote a simple script to test the idea for $x_i = x$:
import numpy as np
def run(N, n, x, runs):
all_diff = 0
for i in range(runs):
all_diff += draw(N, n, x)
return all_diff / runs
def draw(N, n, x):
"""Return 1 if every person picks a different number, return 0 otherwise."""
step = 1 / N
drawn_nums = []
for i in range(n):
person_i_nums = []
j = x
while j > 0:
drawn_num = int(np.random.rand()//step)
if drawn_num not in person_i_nums:
drawn_nums.append(drawn_num)
person_i_nums.append(drawn_num)
j -= 1
if len(drawn_nums) == len(set(drawn_nums)):
return 1
else:
return 0
run(N=50, n=6, x=4, runs=100000) # Out: ~0.003
Forgive me if this question is a duplicate, since there are a million ways to phrase it (this may warrant yet another question...) The closest solution I found was this one, but I would like the "opposite" result (that isn't a simple $1-P$).