Made number of classes in discrete distribution a template parameter.