When I use xdmp:random() like this, I expect this to always return 1, but 
that's not the result.

for $i in (1 to 10)
return count((//element)[xdmp:random(1000)+1])
=> 0 1 0 0 1 2 0 2 0 1

But when I assign the random value to a variable first, the output is as 
expected and execution time is much faster.

for $i in (1 to 10)
let $idx := xdmp:random(1000)+1
return count((//element)[$idx])
=> 1 1 1 1 1 1 1 1 1 1

Is there an explanation for this?

Thanks,

Will 
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to