Programming, Statistics.
where u denotes the generated random numbers that are uniformly distributed in (0,1). Remember that the Inverse CDF above is not including the pity roll for level 4 and 5 rarity items, since it just calculates for one roll. Then, we write the function to simulate the gacha process in these lines of