title: How to populate a list in Prolog?
body: <p>Say you have the following predicate:</p>
  
  <pre><code>random_int(X/Y):-
    random(1,100,X),
    random(1,100,Y),
    X\=Y.
  </code></pre>
  
  <p>How can I populate a list of size n using the result of this predicate?</p>
  
  <p>I tried the following code but it only populates the list if random_int(X) is true at the first attempt, i.e. it does not backtrack to try other combinations of X and Y.</p>
  
  <pre><code>findall(X,(between(1,N,_), random_int(X)),L).
  </code></pre>