You can use functions of the Python module "random" to create a list of 0 and 1 only.
>>> import random>>> sample_size=10>>> labels = [random.randint(0,1) for _ in range(sample_size)]>>> labels[0, 0, 1, 1, 0, 1, 1, 1, 1, 1]>>> labels =[round(random.random()) for _ in range(sample_size)]>>> labels[0, 0, 0, 0, 0, 1, 1, 1, 1, 0]>>> labels =[round(random.uniform(0,1)) for _ in range(sample_size)]>>> labels[0, 0, 0, 1, 0, 0, 1, 1, 1, 0]