def randfill(item, shape):
    """
    Create a numpy array of a specified shape with specified probabilities
    of being each item.
    """
    import numpy as np
    if isinstance(item, float):
        item = {(0): 1.0 - item, (1): item}
    p = np.array(list(item.values()), dtype=float)
    p = p / np.sum(p)
    v = np.array(list(item.keys()), dtype=np.uint64)
    return np.random.choice(v, p=p, size=shape)
