Message 150569 - Python tracker (original) (raw)
r = array.array('l', os.urandom(2**size_exponent)) len_r = len(r)
r size should not depend on the size of a long. You should write something like:
sizeof_long = ctypes.sizeof(ctypes.c_long) r_bits = 8 r = array.array('l', os.urandom((2r_bits) * sizeof_long)) r_mask = 2r_bits-1
The final code will be in C and will use neither ctypes nor array.array. Arguing about this looks quite pointless IMO.