Random Module

From BaseX Documentation
Revision as of 14:50, 19 July 2012 by Dirk (talk | contribs) (Created page with "This XQuery Module contains non-deterministic functions for returning random values. =Conventions= All functions in this module are assigned to the {{Code|ht...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Conventions

All functions in this module are assigned to the http://basex.org/modules/random namespace, which is statically bound to the random prefix.
All errors are assigned to the http://basex.org/errors namespace, which is statically bound to the bxerr prefix.

Functions

random:random-double

Signatures random:random-double() as xs:double()
Summary Returns a double value between 0.0 (inclusive) and 1.0 (exclusive).

random:random-int

Signatures random:random-int($max as xs:integer?) as xs:integer()
Summary Returns an integer value, either in the whole integer range or between 0 (inclusive) and the given maximum (exclusive)

random:seeded-random-double

Signatures random:seeded-random-int($seed as xs:integer, $num as xs:integer) as xs:items()*
Summary Returns an sequence with $num double values between 0.0 (inclusive) and 1.0 (exclusive). The random values are created using the initial seed given in $seed.

random:seeded-random-int

Signatures random:seeded-random-int($seed as xs:integer, $num as xs:integer, $max as xs:integer?) as xs:items()*
Summary Returns an sequence with $num integer values, either in the whole integer range or between 0 (inclusive) and the given maximum (exclusive). The random values are created using the initial seed given in $seed.

Changelog

The module was introduced with Version X. It includes functionality which was previously located in the Math Module.