I want to list all possible permutations of 0 and 1 six times for probability reasons.
I started out like this, thinking, it was a piece of cake; until all combinations are listed the code should keep on randomising the values. However once 0 and 1 are in the list it stops, i thought "for range in 6" would give something like this:
"0,0,0,0,0,0"
(which is a possibility of 0 and 1)
"1,1,1,1,1,1"
(which also is a possibility of 0 and 1)
My current output is "0, 1"
How can I group the items together of pieces of 6 and make the program keep filling values up unless a combination is already in my list?
I know there are 64 combinations altogether because of 2^6.
import math
import random
a = 63;
b = 1;
sequences = [];
while (b < a):
for i in range(6):
num = random.randint(0 , 1)
if(num not in sequences):
sequences.append(num)
b += 1;
else:
b += 1;
print(sorted(sequences));