The easiest way to do this would to to write a pure python implementation using Python ints of a masked integer sampler. This way you could draw unsigned integers and then treat this as a bit pool. You would than take the number of bits needed for your integer, transform these to be a Python int, and finally apply the mask.