Assuming your question is about the technical reasons why <random>
engines requires at least a short as their unsigned template parameters, and not about the general meaning of undefined behaviour in C++.
UIntType
is the parameter name collectively chosen to represent unsigned integer parameters of <random>
facilities, mainly random engines (I suppose for the sake of simplifying and uniformizing the library requirements).
Now, the only types smaller than a short are those having sizeof(T)==1
, hence practically having limits<T>::max == 255
; so, I guess the answer to your question is that 255 is just too small for some(all?) engines to reasonably satisfy random engine semantics under any circumstances.
For example, IIRC linear_congruential
would have a maximal period of 64 and badly uneven distribution in that case; such a thing could be hardly called a pseudo random generator even for the dumbest application scenarios.
Requiring implementations to provide 'functional' unsigned char specializations would be sadistic, to say the least. Of course, being the behaviour undefined, nothing forbids an implementation to omit diagnostic in that case, or even providing such specializations for whatever reason...