Difference between revisions of "Random Module"
Jump to navigation
Jump to search
(Created page with "This XQuery Module contains nondeterministic functions for returning random values. =Conventions= All functions in this module are assigned to the {{Codeht...") 

Line 41:  Line 41:  
    
 '''Summary'''   '''Summary'''  
−  Returns  +  Returns a sequence with {{Code$num}} double values between 0.0 (inclusive) and 1.0 (exclusive). The random values are created using the initial seed given in {{Code$seed}}.<br /> 
    
    
Line 54:  Line 54:  
    
 '''Summary'''   '''Summary'''  
−  Returns  +  Returns a sequence with {{Code$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 {{Code$seed}}.<br /> 
    
    
    
+  }  
+  
+  ==random:randomgaussian==  
+  {  
+    
+   width='90'  '''Signatures'''  
+  {{Funcrandom:randomgaussian$num as xs:integerxs:items()*}}<br />  
+    
+   '''Summary'''  
+  Returns a sequence with {{Code$num}} double values. The random values are Gaussian (i.e. normally) distributed with the mean 0.0. and the derivation 1.0.<br />  
+    
+    
+    
+  }  
+  
+  ==random:uuid==  
+  {  
+    
+   width='90'  '''Signatures'''  
+  {{Funcrandom:uuidxs:string}}  
+    
+   '''Summary'''  
+  Creates a random universally unique identifier (UUID), represented as 128bit value.  
+    
+   '''Examples'''  
+    
+  * {{Codemath:uuid() eq math:uuid()}} will (most probably) return the boolean value {{Codefalse}}.  
}  }  
Revision as of 15:53, 19 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:randomdouble
Signatures  random:randomdouble() as xs:double() 
Summary  Returns a double value between 0.0 (inclusive) and 1.0 (exclusive). 
random:randomint
Signatures  random:randomint($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:seededrandomdouble
Signatures  random:seededrandomint($seed as xs:integer, $num as xs:integer) as xs:items()* 
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:seededrandomint
Signatures  random:seededrandomint($seed as xs:integer, $num as xs:integer, $max as xs:integer?) as xs:items()* 
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:randomgaussian
Signatures  random:randomgaussian($num as xs:integer) as xs:items()* 
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 X. It includes functionality which was previously located in the Math Module.