algorithms/k-means/utilities.py
def generate_random_data(nb_objs, nb_attrs):
    """
    Generates a matrix of random data.
    :param nb_attrs: the dimension of the data
    :type nb_attrs: int
    :return: a matrix with nb_objs rows and nb_attrs+1 columns.
    The 1st column is filled with line numbers (integers, from 1 to nb_objs).
    """
    data = []
    for i in range(nb_objs):
        line = [i + 1] + list(map(lambda x: random.random(), range(nb_attrs)))
        data.append(tuple(line))
    return data

    Generates a matrix of random data.
    :param nb_attrs: the dimension of the data
    :type nb_attrs: int
    :return: a matrix with nb_objs rows and nb_attrs+1 columns.
    The 1st column is filled with line numbers (integers, from 1 to nb_objs).
    
Generates a matrix of random data.
Generates a matrix of random data .
def generate_random_data(nb_objs, nb_attrs):
    data = []
    for i in range(nb_objs):
        line = [i + 1] + list(map(lambda x: random.random(), range(nb_attrs)))
        data.append(tuple(line))
    return data
def generate_random_data ( nb_objs , nb_attrs ) : data = [ ] for i in range ( nb_objs ) : line = [ i + 1 ] + list ( map ( lambda x : random . random ( ) , range ( nb_attrs ) ) ) data . append ( tuple ( line ) ) return data
Generates a matrix of random data.
Generates a matrix of random data .
"""
    Generates a matrix of random data.
    :param nb_attrs: the dimension of the data
    :type nb_attrs: int
    :return: a matrix with nb_objs rows and nb_attrs+1 columns.
    The 1st column is filled with line numbers (integers, from 1 to nb_objs).
    """
a matrix with nb_objs rows and nb_attrs+1 columns.
The 1st column is filled with line numbers (integers, from 1 to nb_objs).
a matrix with nb_objs rows and nb_attrs + 1 columns . The 1st column is filled with line numbers ( integers from 1 to nb_objs ) .
nb_objs
nb_attrs
the dimension of the data
the dimension of the data