title: Neo4j: Difference between rand() and rand() in with clause when matching random nodes
body: <p>I found <a href="https://stackoverflow.com/questions/12510696/neo4j-is-there-a-way-how-to-select-random-nodes">here</a> that i can select random nodes from neo4j using next queries:</p>
  <ol>
  <li><code>MATCH (a:Person) RETURN a ORDER BY rand() limit 10</code></li>
  <li><code>MATCH (a:Person) with a, rand() as rnd RETURN a ORDER BY rnd limit 10</code></li>
  </ol>
  <p>Both queries seems to do the same thing but when I try to match random nodes that are in relationship with a given node then I have different results:</p>
  <p>The next query will return always the same nodes (nodes are not randomly selected)</p>
  <pre><code>MATCH (p:Person{user_id: '1'})-[r:REVIEW]-&gt;(m:Movie)
  return m order by rand() limit 10
  </code></pre>
  <p>...but when I use rand() in a with clause I get indeed random nodes:</p>
  <pre><code>MATCH (p:Person{user_id: '1'})-[r:REVIEW]-&gt;(m:Movie)
  with m, rand() as rnd
  return m order by rnd limit 10
  </code></pre>
  <p>Any idea why rand() behave different in a with clause in the second query but in the first not?</p>