Difference between revisions of "Random Module"
Jump to navigation
Jump to search
m (moved User:Dirk/Random Module to Random Module) 

Line 89:  Line 89:  
=Changelog=  =Changelog=  
−  The module was introduced with Version  +  The module was introduced with Version 7.4. It includes some functionality which was previously located in the [[Math_ModuleMath Module]]. 
[[Category:XQuery]]  [[Category:XQuery]] 
Revision as of 11:17, 20 July 2012
This XQuery Module contains nondeterministic functions for returning random values.
Contents
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:double
Signatures  random:double() as xs:double 
Summary  Returns a double value between 0.0 (inclusive) and 1.0 (exclusive). 
random:integer
Signatures  random:integer() as xs:integer random:integer($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:seededdouble
Signatures  random:seededdouble($seed as xs:integer, $num as xs:integer) as xs:double* 
Summary  Returns a 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:seededinteger
Signatures  random:seededinteger($seed as xs:integer, $num as xs:integer) as xs:integer* random:seededinteger($seed as xs:integer, $num as xs:integer, $max as xs:integer) as xs:integer*

Summary  Returns a 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 . 
random:gaussian
Signatures  random:gaussian($num as xs:integer) as xs:double* 
Summary  Returns a sequence with $num double values. The random values are Gaussian (i.e. normally) distributed with the mean 0.0. and the derivation 1.0. 
random:uuid
Signatures  random:uuid() as xs:string

Summary  Creates a random universally unique identifier (UUID), represented as 128bit value. 
Examples 

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