<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.8">
<title>MLtonRandom</title>
<link rel="stylesheet" href="./asciidoc.css" type="text/css">
<link rel="stylesheet" href="./pygments.css" type="text/css">


<script type="text/javascript" src="./asciidoc.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
asciidoc.install();
/*]]>*/
</script>
<link rel="stylesheet" href="./mlton.css" type="text/css"/>
</head>
<body class="article">
<div id="banner">
<div id="banner-home">
<a href="./Home">MLton 20130715</a>
</div>
</div>
<div id="header">
<h1>MLtonRandom</h1>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="listingblock">
<div class="content"><div class="highlight"><pre><span class="k">signature</span><span class="w"> </span><span class="n">MLTON_RANDOM</span><span class="w"> </span><span class="p">=</span><span class="w"></span>
<span class="w">   </span><span class="k">sig</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">alphaNumChar</span><span class="p">:</span><span class="w"> </span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">char</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">alphaNumString</span><span class="p">:</span><span class="w"> </span><span class="n">int</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">string</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">rand</span><span class="p">:</span><span class="w"> </span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">word</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">seed</span><span class="p">:</span><span class="w"> </span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">word</span><span class="w"> </span><span class="n">option</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">srand</span><span class="p">:</span><span class="w"> </span><span class="n">word</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">unit</span><span class="w"></span>
<span class="w">      </span><span class="k">val</span><span class="w"> </span><span class="n">useed</span><span class="p">:</span><span class="w"> </span><span class="n">unit</span><span class="w"> </span><span class="p">-&gt;</span><span class="w"> </span><span class="n">word</span><span class="w"> </span><span class="n">option</span><span class="w"></span>
<span class="w">   </span><span class="k">end</span><span class="w"></span>
</pre></div></div></div>
<div class="ulist"><ul>
<li>
<p>
<span class="monospaced">alphaNumChar ()</span>
</p>
<div class="paragraph"><p>returns a random alphanumeric character.</p></div>
</li>
<li>
<p>
<span class="monospaced">alphaNumString n</span>
</p>
<div class="paragraph"><p>returns a string of length <span class="monospaced">n</span> of random alphanumeric characters.</p></div>
</li>
<li>
<p>
<span class="monospaced">rand ()</span>
</p>
<div class="paragraph"><p>returns the next pseudo-random number.</p></div>
</li>
<li>
<p>
<span class="monospaced">seed ()</span>
</p>
<div class="paragraph"><p>returns a random word from <span class="monospaced">/dev/random</span>.  Useful as an arg to
<span class="monospaced">srand</span>.  If <span class="monospaced">/dev/random</span> can not be read from, <span class="monospaced">seed ()</span> returns
<span class="monospaced">NONE</span>.  A call to <span class="monospaced">seed</span> may block until enough random bits are
available.</p></div>
</li>
<li>
<p>
<span class="monospaced">srand w</span>
</p>
<div class="paragraph"><p>sets the seed used by <span class="monospaced">rand</span> to <span class="monospaced">w</span>.</p></div>
</li>
<li>
<p>
<span class="monospaced">useed ()</span>
</p>
<div class="paragraph"><p>returns a random word from <span class="monospaced">/dev/urandom</span>.  Useful as an arg to
<span class="monospaced">srand</span>.  If <span class="monospaced">/dev/urandom</span> can not be read from, <span class="monospaced">useed ()</span> returns
<span class="monospaced">NONE</span>.  A call to <span class="monospaced">useed</span> will never block&#8201;&#8212;&#8201;it will instead return
lower quality random bits.</p></div>
</li>
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr></div>
<div id="footer">
<div id="footer-text">
</div>
<div id="footer-badges">
</div>
</div>
</body>
</html>
