First time here? Check out the FAQ!
answered 0 years ago
sage: length = 10 sage: Bitset(f"{{:0{length}b}}".format(randint(0, 2**length - 1))) 0010101001 sage: Bitset(f"{{:0{length}b}}".format(randint(0, 2**length - 1))) 1100101000