It's not random, however, there are some set rules.
No, that's not true at all. In the "Real World" the IPO Share distribution isn't fair at all. People with the best connections get the most shares. That's how it works. If this IPO was done as it was in the real world, most people wouldn't have gotten shares at all unless they knew the founders or burnside.
People with good connections would have gotten the shares.