(self, n)
return r
Return a random int in the range [0,n).  Returns 0 if n==0.
Return a random int in the range [0,n).  Returns 0 if n==0.
Return a random int in the range [ 0 n ) . Returns 0 if n == 0 .
def _randbelow_with_getrandbits(self, n):
        "Return a random int in the range [0,n).  Returns 0 if n==0."

        if not n:
            return 0
        getrandbits = self.getrandbits
        k = n.bit_length()  # don't use (n-1) here because n can be 1
        r = getrandbits(k)  # 0 <= r < 2**k
        while r >= n:
            r = getrandbits(k)
        return r
def _randbelow_with_getrandbits ( self , n ) : if not n : return 0 getrandbits = self . getrandbits k = n . bit_length ( ) # don't use (n-1) here because n can be 1 r = getrandbits ( k ) # 0 <= r < 2**k while r >= n : r = getrandbits ( k ) return r