The categorical distribution is like a bowl of colored balls. Let us say we know know the bowl statistics, meaning that we know how many balls there are of each color, let us say red, green, and blue. Then we pick a ball at random. Given the statistics, we can calculate the probability that the ball we picked is red. This probability is modeled by a categorical probability distribution of the ball colors.
I needed a software package to help me use categorical distributions in my web applications and adaptive user interfaces. It is so common distribution that I thought others might need it too. As a result, I created categorical-distribution.js and released it to the world with an open source licence. It is targeted for JavaScript projects both client-side and server-side (Node.js).
See more at npmjs.com/package/categorical-distribution