Hi, I’m the guy behind this code. First we roll the type of the gem: 1-star, 2-star or a ?/5-star and then if the rolled gem is ?/5-star, we determine the amount of stars that it will have using the probability array at the bottom of the code snippet, that you attached.