Is it possible to generate random numbers using XQuery?

I need to create a series of random numbers using XQuery. I found a set of libraries, but they are paid. If someone can give me directions, it will be very helpful (preferably code).

+4
source share
1 answer

The standard XQuery languages ​​do not provide random functions, but many implementations are executed. Some examples of open source implementations:

Alternatively, most Java XQuery implementations (such as BaseX, Saxon, or Qizx) provide what are called Java bindings for evaluating Java code:

declare namespace math = 'java:java.lang.Math'; math:random() 

If the implementation supports the latest XQuery 3.0 specification, this can also be written as single-line:

 Q{java:java.lang.Math}random() 
+7
source

All Articles