Ahh, you are correct, that is a large bug... How about this one? def s2num(text): if(len(text)==1): return ord(text) else: return ord(text[0])+256*s2num(text[1:])
def cran_rand(min,max): range=int(log(abs(max-min))/log(2))+1 num=max+1 if range%8==0: crange=range/8 else: crange=range/8+1 while(num>max): num=min+s2num(urandom(crange))%(2**range) return num -- http://mail.python.org/mailman/listinfo/python-list