There is the element of randomness, but it isn't all random. Like someone said, a single throw of the dice is random; but if you throw it over and over, the numbers will even out.
There are other factors, though. There is how many eggs you hatch, how many of pokestops you visit are ones that...