diff options
Diffstat (limited to 'gbdk/docs/api/rand_8h.html')
| -rw-r--r-- | gbdk/docs/api/rand_8h.html | 310 |
1 files changed, 310 insertions, 0 deletions
diff --git a/gbdk/docs/api/rand_8h.html b/gbdk/docs/api/rand_8h.html new file mode 100644 index 00000000..cf2f0793 --- /dev/null +++ b/gbdk/docs/api/rand_8h.html @@ -0,0 +1,310 @@ +<!-- HTML header for doxygen 1.8.14--> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="cache-control" content="max-age=86400"/> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.20"/> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>GBDK 2020 Docs: rand.h File Reference</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="navtree.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="resize.js"></script> +<script type="text/javascript" src="navtreedata.js"></script> +<script type="text/javascript" src="navtree.js"></script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +<link href="doxygen_extra.css" rel="stylesheet" type="text/css"/> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <td id="projectalign" style="padding-left: 0.5em;"> + <div id="projectname">GBDK 2020 Docs +  <span id="projectnumber">4.0.6</span> + </div> + <div id="projectbrief">API Documentation for GBDK 2020</div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.20 --> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +/* @license-end */ +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +/* @license-end */</script> +<div id="main-nav"></div> +</div><!-- top --> +<div id="side-nav" class="ui-resizable side-nav-resizable"> + <div id="nav-tree"> + <div id="nav-tree-contents"> + <div id="nav-sync" class="sync"></div> + </div> + </div> + <div id="splitbar" style="-moz-user-select:none;" + class="ui-resizable-handle"> + </div> +</div> +<script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +$(document).ready(function(){initNavTree('rand_8h.html',''); initResizable(); }); +/* @license-end */ +</script> +<div id="doc-content"> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="header"> + <div class="summary"> +<a href="#define-members">Macros</a> | +<a href="#func-members">Functions</a> | +<a href="#var-members">Variables</a> </div> + <div class="headertitle"> +<div class="title">rand.h File Reference</div> </div> +</div><!--header--> +<div class="contents"> +<div class="textblock"><code>#include <<a class="el" href="types_8h_source.html">types.h</a>></code><br /> +<code>#include <<a class="el" href="stdint_8h_source.html">stdint.h</a>></code><br /> +</div> +<p><a href="rand_8h_source.html">Go to the source code of this file.</a></p> +<table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> +Macros</h2></td></tr> +<tr class="memitem:a690f251553b39fd4f31894826141b61a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="rand_8h.html#a690f251553b39fd4f31894826141b61a">RAND_MAX</a>   255</td></tr> +<tr class="separator:a690f251553b39fd4f31894826141b61a"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a6dbd2f1a15221db40f456cf574a793b4"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="rand_8h.html#a6dbd2f1a15221db40f456cf574a793b4">RANDW_MAX</a>   65535</td></tr> +<tr class="separator:a6dbd2f1a15221db40f456cf574a793b4"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> +Functions</h2></td></tr> +<tr class="memitem:a964538799843c0ba5bd01151ef7e2640"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="rand_8h.html#a964538799843c0ba5bd01151ef7e2640">initrand</a> (<a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> seed) <a class="el" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a></td></tr> +<tr class="separator:a964538799843c0ba5bd01151ef7e2640"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a21e0cee33278952c044f27d02c0b0d1a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rand_8h.html#a21e0cee33278952c044f27d02c0b0d1a">rand</a> () <a class="el" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a></td></tr> +<tr class="separator:a21e0cee33278952c044f27d02c0b0d1a"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:ac659150eb39aae2f523bef6554b19b77"><td class="memItemLeft" align="right" valign="top"><a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rand_8h.html#ac659150eb39aae2f523bef6554b19b77">randw</a> () <a class="el" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a></td></tr> +<tr class="separator:ac659150eb39aae2f523bef6554b19b77"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a333400f85febd7e1360835955103db8b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="rand_8h.html#a333400f85febd7e1360835955103db8b">initarand</a> (<a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> seed) <a class="el" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a></td></tr> +<tr class="separator:a333400f85febd7e1360835955103db8b"><td class="memSeparator" colspan="2"> </td></tr> +<tr class="memitem:a67415330a1c7984e4537dac753306804"><td class="memItemLeft" align="right" valign="top"><a class="el" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rand_8h.html#a67415330a1c7984e4537dac753306804">arand</a> () <a class="el" href="asm_2types_8h.html#a0971918860055db2e50dacea4da8f3bc">OLDCALL</a></td></tr> +<tr class="separator:a67415330a1c7984e4537dac753306804"><td class="memSeparator" colspan="2"> </td></tr> +</table><table class="memberdecls"> +<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a> +Variables</h2></td></tr> +<tr class="memitem:a7aab2f4a234108a5eae48e0d26380ae7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rand_8h.html#a7aab2f4a234108a5eae48e0d26380ae7">__rand_seed</a></td></tr> +<tr class="separator:a7aab2f4a234108a5eae48e0d26380ae7"><td class="memSeparator" colspan="2"> </td></tr> +</table> +<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> +<div class="textblock"><p>Random generator using the linear congruential method</p> +<dl class="section author"><dt>Author</dt><dd>Luc Van den Borre </dd></dl> +</div><h2 class="groupheader">Macro Definition Documentation</h2> +<a id="a690f251553b39fd4f31894826141b61a"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a690f251553b39fd4f31894826141b61a">◆ </a></span>RAND_MAX</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define RAND_MAX   255</td> + </tr> + </table> +</div><div class="memdoc"> + +</div> +</div> +<a id="a6dbd2f1a15221db40f456cf574a793b4"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a6dbd2f1a15221db40f456cf574a793b4">◆ </a></span>RANDW_MAX</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">#define RANDW_MAX   65535</td> + </tr> + </table> +</div><div class="memdoc"> + +</div> +</div> +<h2 class="groupheader">Function Documentation</h2> +<a id="a964538799843c0ba5bd01151ef7e2640"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a964538799843c0ba5bd01151ef7e2640">◆ </a></span>initrand()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">void initrand </td> + <td>(</td> + <td class="paramtype"><a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> </td> + <td class="paramname"><em>seed</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> +<p>Initalise the pseudo-random number generator.</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">seed</td><td>The value for initializing the random number generator.</td></tr> + </table> + </dd> +</dl> +<p>The seed should be different each time, otherwise the same pseudo-random sequence will be generated.</p> +<p>The DIV Register (<a class="el" href="gb_2hardware_8h.html#afa1e18e47bf68ce68d7807fff6edf16b">DIV_REG</a>) is sometimes used as a seed, particularly if read at some variable point in time (such as when the player presses a button).</p> +<p>Only needs to be called once to initialize, but may be called again to re-initialize with the same or a different seed.</p> +<dl class="section see"><dt>See also</dt><dd><a class="el" href="rand_8h.html#a21e0cee33278952c044f27d02c0b0d1a">rand()</a>, <a class="el" href="rand_8h.html#ac659150eb39aae2f523bef6554b19b77">randw()</a> </dd></dl> + +</div> +</div> +<a id="a21e0cee33278952c044f27d02c0b0d1a"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a21e0cee33278952c044f27d02c0b0d1a">◆ </a></span>rand()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> rand </td> + <td>(</td> + <td class="paramname"></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> +<p>Returns a random byte (8 bit) value.</p> +<p><a class="el" href="rand_8h.html#a964538799843c0ba5bd01151ef7e2640">initrand()</a> should be used to initialize the random number generator before using <a class="el" href="rand_8h.html#a21e0cee33278952c044f27d02c0b0d1a">rand()</a> </p> + +</div> +</div> +<a id="ac659150eb39aae2f523bef6554b19b77"></a> +<h2 class="memtitle"><span class="permalink"><a href="#ac659150eb39aae2f523bef6554b19b77">◆ </a></span>randw()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> randw </td> + <td>(</td> + <td class="paramname"></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> +<p>Returns a random word (16 bit) value.</p> +<p><a class="el" href="rand_8h.html#a964538799843c0ba5bd01151ef7e2640">initrand()</a> should be used to initialize the random number generator before using <a class="el" href="rand_8h.html#a21e0cee33278952c044f27d02c0b0d1a">rand()</a> </p> + +</div> +</div> +<a id="a333400f85febd7e1360835955103db8b"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a333400f85febd7e1360835955103db8b">◆ </a></span>initarand()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname">void initarand </td> + <td>(</td> + <td class="paramtype"><a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> </td> + <td class="paramname"><em>seed</em></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> +<p>Random generator using the linear lagged additive method</p> +<dl class="params"><dt>Parameters</dt><dd> + <table class="params"> + <tr><td class="paramname">seed</td><td>The value for initializing the random number generator.</td></tr> + </table> + </dd> +</dl> +<p>Note: <a class="el" href="rand_8h.html#a333400f85febd7e1360835955103db8b">initarand()</a> calls <a class="el" href="rand_8h.html#a964538799843c0ba5bd01151ef7e2640">initrand()</a> with the same seed value, and uses <a class="el" href="rand_8h.html#a21e0cee33278952c044f27d02c0b0d1a">rand()</a> to initialize the random generator.</p> +<dl class="section see"><dt>See also</dt><dd><a class="el" href="rand_8h.html#a964538799843c0ba5bd01151ef7e2640">initrand()</a> for suggestions about seed values, <a class="el" href="rand_8h.html#a67415330a1c7984e4537dac753306804">arand()</a> </dd></dl> + +</div> +</div> +<a id="a67415330a1c7984e4537dac753306804"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a67415330a1c7984e4537dac753306804">◆ </a></span>arand()</h2> + +<div class="memitem"> +<div class="memproto"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="stdint_8h.html#aba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> arand </td> + <td>(</td> + <td class="paramname"></td><td>)</td> + <td></td> + </tr> + </table> +</div><div class="memdoc"> +<p>Returns a random number generated with the linear lagged additive method.</p> +<p><a class="el" href="rand_8h.html#a333400f85febd7e1360835955103db8b">initarand()</a> should be used to initialize the random number generator before using <a class="el" href="rand_8h.html#a67415330a1c7984e4537dac753306804">arand()</a> </p> + +</div> +</div> +<h2 class="groupheader">Variable Documentation</h2> +<a id="a7aab2f4a234108a5eae48e0d26380ae7"></a> +<h2 class="memtitle"><span class="permalink"><a href="#a7aab2f4a234108a5eae48e0d26380ae7">◆ </a></span>__rand_seed</h2> + +<div class="memitem"> +<div class="memproto"> +<table class="mlabels"> + <tr> + <td class="mlabels-left"> + <table class="memname"> + <tr> + <td class="memname"><a class="el" href="stdint_8h.html#adf4d876453337156dde61095e1f20223">uint16_t</a> __rand_seed</td> + </tr> + </table> + </td> + <td class="mlabels-right"> +<span class="mlabels"><span class="mlabel">extern</span></span> </td> + </tr> +</table> +</div><div class="memdoc"> +<p>The random number seed is stored in __rand_seed and can be saved and restored if needed.</p> +<div class="fragment"><div class="line"><span class="comment">// Save</span></div> +<div class="line">some_uint16 = <a class="code" href="rand_8h.html#a7aab2f4a234108a5eae48e0d26380ae7">__rand_seed</a>;</div> +<div class="line">...</div> +<div class="line"><span class="comment">// Restore</span></div> +<div class="line">__rand_seed = some_uint16;</div> +</div><!-- fragment --> +</div> +</div> +</div><!-- contents --> +</div><!-- doc-content --> +<div class="ttc" id="arand_8h_html_a7aab2f4a234108a5eae48e0d26380ae7"><div class="ttname"><a href="rand_8h.html#a7aab2f4a234108a5eae48e0d26380ae7">__rand_seed</a></div><div class="ttdeci">uint16_t __rand_seed</div></div> +<!-- HTML footer for doxygen 1.8.14--> +<!-- start footer part --> +<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> +</div> +</body> +</html> |
