title: How can we select a random data set from the list of solutions given by Prolog?
body: <p>i am new to prolog and working my way through the FD solvers in it. I am exploring both SWI-Prolog and Gnu Prolog. I have a case where a constraint like below needs to be solved and one of the possible solutions needs to be picked at random based on a seed. Not sure how much of it is possible in Prolog. </p>
  
  <p>Below is the equation i am trying to solve:</p>
  
  <pre><code>?- X #&lt; 7 , X #&gt; -10, 4*X+2*Y #&lt; 8, Y #&lt; 10, Y #&gt;0, label([X]).
  X = -9,
  Y in 1..9 ;
  X = -8,
  Y in 1..9 ;
  X = -7,
  Y in 1..9 ;
  X = -6,
  Y in 1..9 ;
  X = -5,
  Y in 1..9 ;
  X = -4,
  Y in 1..9 ;
  X = -3,
  Y in 1..9 ;
  X = -2,
  Y in 1..7 ;
  X = -1,
  Y in 1..5 ;
  X = 0,
  Y in 1..3 ;
  X = Y, Y = 1.
  </code></pre>
  
  <p>As you can see above, it gives me multiple solutions. For my application, I would be interested in choosing one of the data set from above based on a seed.  </p>
  
  <p>Is this possible in prolog? It would be great if you can help me with your suggestions.</p>
  
  <p>Thanks,
  Venkat</p>