Qrandint uniformity

Hello,

from the docs (Search Space API — Ray v1.4.1):

#Sample a random uniformly between -21 (inclusive) and 12 (inclusive (!))
#rounding to increments of 3 (includes 12)
"qrandint": tune.qrandint(-21, 12, 3)

However, if I run the following code:

from ray.tune.sample import qrandint

r = qrandint(-21, 12, 3)

c = 0
for i in range(1000):
    if r.sample() == 12:
        c += 1

print("c=" + str(c))

The printed value is always approximately 40, i.e., half of what I’d expect from uniform value generation.

Also, the following code seems to always end up printing 0:

from ray.tune.sample import qrandint

r = qrandint(0, 2, 1)

c = 0
for i in range(1000):
    if r.sample() == 2:
        c += 1

print("c=" + str(c))

Even though from the docs I’d assume the number 2 should be included. Is that the expected behaviour?