jeudi 22 décembre 2016

Fill array with values from list with random order but no doubles

I have a list like:

[a,a,a,a,b,b,b,b,c,c,c,c,d,d,d,d,e,e,e,e,f,f,f,g,g,g,h,h,h,i,i,j,j,l,l,m,n,o,p]

and an empty array like:

matrix = numpy.emtpy(X, Y)

with:

  • X = number of unique letters (here 16)
  • Y >= max nr of repetition (here >=4, lets say 5 )

I want to fill the empty array such that:

  • each column contains at least one letter
  • each column contains only unique letters
  • no column contains the same letters as another column, unless randomly assigned
  • all columns contain an equal nr of letters or, if that's not possible, maximum 1 letter difference

The rest of matrix maintains empty.




Aucun commentaire:

Enregistrer un commentaire