openclonk/docs/sdk/script/fn/RandomX.xml

42 lines
1.3 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>RandomX</title>
<category>Arithmetics</category>
<version>5.1 OC</version>
<syntax>
<rtype>int</rtype>
<params>
<param>
<type>int</type>
<name>value1</name>
<desc>Range start</desc>
<optional />
</param>
<param>
<type>int</type>
<name>value2</name>
<desc>Range end</desc>
<optional />
</param>
</params>
</syntax>
<desc>Yields a random value from value1 to value2. It does not matter, which limit is greater or less.</desc>
<examples>
<example>
<code><funclink>SetXDir</funclink>(RandomX(-20,+20));</code>
<text>Sets horizontal speed of the object to a random value between -20 and +20.</text>
</example>
<example>
<code><funclink>Message</funclink>(&quot;Daniel has %d bread rolls!&quot;, RandomX(42,23));</code>
<text>Returns the number of Daniel's random bread rolls. This may be a value from 23 to 42.</text>
</example>
</examples>
<related><funclink>Random</funclink></related>
</func>
<author>flgr</author><date>2002-01</date>
</funcs>