Difference between revisions of "Command/getrandomnumber"

From Wiki
Jump to navigation Jump to search
m (Created page with "= Overview = The {{cmd|getrandomnumber}} command provides a mechanism to create a macro initialized to a random value. = Example = <textcode source="yes"> \starttext \getran...")
 
m
Line 5: Line 5:
 
= Example =
 
= Example =
  
<textcode source="yes">
+
The following example produces a random number between 1 and 10.
 +
 
 +
<texcode source="yes">
 
\starttext
 
\starttext
   \getrandomnumber \n {3} {5}
+
   \getrandomnumber \n {1} {10}
 
   \n
 
   \n
 
\stoptext
 
\stoptext
</textcode>
+
</texcode>

Revision as of 08:12, 31 March 2014

Overview

The \getrandomnumber command provides a mechanism to create a macro initialized to a random value.

Example

The following example produces a random number between 1 and 10.

\starttext
  \getrandomnumber \n {1} {10}
  \n
\stoptext