def generate_column_from_distribution()

in src/generate_matrices.py [0:0]


def generate_column_from_distribution(dist, groupsize):
    """
    :param dist:  3-tuple containing (is_uniform, mean, variability)
    :param groupsize: the number of rows in the column vector
    :return: column vector of length groupsize according to distribution
    """
    mean = dist[1]
    variability = dist[2]

    if dist[0]:  # If we are sampling from the uniform
        # Generate and return a column vector whose elements are sampled uniformly within the specified bounds
        return np.random.randint(mean - variability, mean + variability, (groupsize, 1))

    else:  # Otherwise we are sampling from the normal
        # Create a unit normal, then multiply all elements to increase std. dev while at mean 0, then add mean after
        return (np.random.randn(groupsize, 1) * variability) + mean