The probability of hypernucleus production in high-energy heavy-ion collisions