Handling random numbers better
Sometimes, we need to create random behaviors that don't differ too much from a pivot point; this is the case for an aiming behavior. A normalized random behavior would shoot equally along the x and y axes, given a distance from the aiming point; however, we would like most of the bullets to aim close, because that's the expected behavior.
Most of the random functions out there return normalized values along the range given to them, and those are the expected results. Nonetheless, this is not completely useful for certain features in game development, as we just discussed. So now, we will be implementing a random function to be used in our games with normal distribution instead of a normal distribution.
Getting ready
It is important to understand the differences between uniform and normal distribution. In the following diagram, on the right-hand side, we can see a graphical representation of the behavior we're looking for by applying normal distribution with the...