Loading TOC...

xdmp:random

xdmp:random(
   [$max as xs:unsignedLong]
) as xs:unsignedLong

Summary

Returns a random unsigned integer between 0 and a number up to 64 bits long.

Parameters
$max The optional maximum value (inclusive).

Example

xdmp:random(100)
=> 47

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • An example of weighted random sampling with xquery https://gist.github.com/xquery/6831758