Assumptions:

•

Each person chooses a room independently from the other people•

Each person is equally likely to choose any of the roomsimport matplotlib.pyplot as plt
import pandas as pd
import random
random.seed(269027)

number_of_people = 15
number_of_rooms = 3
people = [*range(1, number_of_people + 1, 1)]
rooms = [*range(1, number_of_rooms + 1, 1)]

simulations = [1, 10, 50, 100, 500, 1000, 5000, 10000, 50000, 100000, 500000, 1000000, 5000000]

Using the properties of numbers and math, when all 3 rooms are equal size we know the difference between the largest and smallest room has to be 0

estimated_probability = []
for s in simulations:
print('# of simulations:' + str(s))
room_size_delta = []
for i in range(s):
room_members = [[] for _ in range(number_of_rooms)]
for p in people:
room_assignment = random.choice(rooms)
room_members[room_assignment - 1] += [p]
room_size_delta += [max([len(x) for x in room_members]) - min([len(x) for x in room_members])]
probability = len([x for x in room_size_delta if x == 0])/len(room_size_delta)
print('estimated probability of equal rooms: ' + str(probability))
estimated_probability += [[s, probability]]

```
# of simulations:1
estimated probability of equal rooms: 0.0
# of simulations:10
estimated probability of equal rooms: 0.1
# of simulations:50
estimated probability of equal rooms: 0.02
# of simulations:100
estimated probability of equal rooms: 0.04
# of simulations:500
estimated probability of equal rooms: 0.05
# of simulations:1000
estimated probability of equal rooms: 0.055
# of simulations:5000
estimated probability of equal rooms: 0.0506
# of simulations:10000
estimated probability of equal rooms: 0.0532
# of simulations:50000
estimated probability of equal rooms: 0.0532
# of simulations:100000
estimated probability of equal rooms: 0.0528
# of simulations:500000
estimated probability of equal rooms: 0.052468
# of simulations:1000000
estimated probability of equal rooms: 0.052645
# of simulations:5000000
estimated probability of equal rooms: 0.0528228
```

plt.figure(figsize=(12,6))
plt.hist(room_size_delta, density=True, bins=15)
plt.ylabel('Frequency')
plt.xlabel('Delta between largest room and smallest room')

probability_trend = pd.DataFrame(estimated_probability)
probability_trend.columns = ['simulations', 'probability']

plt.figure(figsize=(12,6))
plt.plot(probability_trend.simulations, probability_trend.probability)
plt.xlabel('Number of simulations')
plt.ylabel('Estimated probability of equal size rooms')