import random


def split_data(data, weight):
    
    """
    Randomly split data into train and tesst split
    """

    train_length = int(len(data) * (1 - weight))
    train = []
    for i in range(train_length):
        idx = random.randrange((len(data)))
        train.append(data[idx])
        data.pop(idx)
    return [train, data]