Discrete uniform distribution

Hello,
Openturns does not provide a uniform discrete distribution to my knowledge. I think that it would be a useful feature to add

regards,
sanaa

hi,
checkout the UserDefined distribution

yes, exactly what i ended up using. I had to adapt some of my code (a chi2 test namely) but it worked just fine.
I thought it was worth mentioning here in terms of usability. The uniform distribution is much more widespread than some of the discrete distributions that are coded in OT, and a implementation would come in handy in my opinion

Hi,
To get a discrete distribution over {0,…,n} you can write:

import openturns as ot

n = 10
d = ot.UserDefined([[i] for i in range(n+1)])

Not so intuitive, but not a nightmare. Now, try to do the same for e.g. the Poisson distribution and you will see why it has a specific implementation. The point is that a UniformDiscrete class will essentially be a duplicate of UserDefined (same code, same performance, but two classes to maintain, document and test). Maybe a new constructor in UserDefined could do the job?