It has been awhile, but I think they come up randomly. But, I also think pacman didn't use random variables as you can accomplish a level by following the same path with the same result - so maybe they come up from a certain sequence...
But that all depends on which version
Did that even make sense?
Bookmarks