from digit_bin_index import DigitBinIndex
def main():
index = DigitBinIndex()
index_5 = DigitBinIndex.with_precision(5)
index_3_xl = DigitBinIndex.with_precision_and_capacity(3, 10_000_000)
index.add(id=101, weight=0.123) index.add(id=202, weight=0.800) index.add(id=303, weight=0.755) index.add(id=404, weight=0.110)
selected_item = index.select_and_remove()
if selected_item:
item_id, weight = selected_item
print(f"Wallenius draw: ID {item_id}, Weight ~{weight:.3f}")
print(f"Items remaining: {index.count()}")
selected_items = index.select_many_and_remove(2)
if selected_items:
print(f"Fisher's draw: {selected_items}")
print(f"Items remaining: {index.count()}")
if __name__ == "__main__":
main()