For illustrating this issue, create thousand nodes labeled z having incrementing numeric attribute zid.
FOREACH (i IN range(1, 1000)| CREATE (z:z { zid: i }));
Now find a node using random zid value between 1 and 1000.
MATCH (n:z { zid: round(rand()*1000)})
RETURN n;
The above cypher returns inconsistent results, sometimes no nodes are returned, sometimes multiple nodes are returned.
Tweaking the cypher as follows yields consistent results.
WITH round(rand()*1000) AS x
MATCH (n:z { zid: x })
RETURN x, n;
What is wrong with the first cypher query ?