Skip to content

Commit f0847f8

Browse files
inclusiver upper bound on DiscreteUniform fixes #2592
draw random samples with inclusive upper bound (just like the theano sampling does)
1 parent 36ab005 commit f0847f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pymc3/distributions/discrete.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ def __init__(self, lower, upper, *args, **kwargs):
447447
def _random(self, lower, upper, size=None):
448448
# This way seems to be the only to deal with lower and upper
449449
# as array-like.
450-
samples = stats.uniform.rvs(lower, upper - lower - np.finfo(float).eps,
450+
samples = stats.uniform.rvs(lower,
451+
upper + 1 - lower - np.finfo(float).eps,
451452
size=size)
452453
return np.floor(samples).astype('int32')
453454

0 commit comments

Comments
 (0)