Is there a way to get a random solution from pycosat every time I run it?

115 views Asked by At

I am given a completely blank sudoku and I want that it should produce fairly different answers when executed. Currently I am choosing a random integer say( x ) and iterate over solutions till I reach x:-

i=0
for lists in pycosat.itersolve(clauses):
 i=i+1
 if(i==x):
   sol = lists

Now take sol to get the required sudoku solution. This is very inefficient. Is there a efficient(faster) way to do it?

0

There are 0 answers