from typing import Sequence
import random


def sample_coins(coin_biases: Sequence[float]) -> int:
    """Return integer where bits bias towards 1 as described in coin_biases."""
    result = 0
    for i, bias in enumerate(coin_biases):
        result |= int(random.random() < bias) << i
    return result