cl-pcg/reference/index.html @ 0f6bab39c0f4 default tip

adopt: Update site.
author Steve Losh <steve@stevelosh.com>
date Thu, 13 Jun 2024 13:05:28 -0400
parents 511800267161
children (none)
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <title> API Reference / cl-pcg</title>
        <link rel="stylesheet" href="../_dmedia/tango.css"/>
        <link rel="stylesheet/less" type="text/css" href="../_dmedia/style.less"/>
        <script src="../_dmedia/less.js" type="text/javascript">
        </script>
    </head>
    <body class="content">
        <div class="wrap">
            <header><h1><a href="..">cl-pcg</a></h1></header>
                <div class="markdown">
<h1 id="api-reference"><a href="">API Reference</a></h1><p>The following is a list of all user-facing parts of <code>cl-pcg</code>.</p>
<p>If there are backwards-incompatible changes to anything listed here, they will
be noted in the changelog and the author will feel bad.</p>
<p>Anything not listed here is subject to change at any time with no warning, so
don't touch it.</p>
<div class="toc">
<ul>
<li><a href="#package-pcg">Package PCG</a><ul>
<li><a href="#make-pcg-function">MAKE-PCG (function)</a></li>
<li><a href="#make-pcg-function_1">MAKE-PCG% (function)</a></li>
<li><a href="#pcg-struct">PCG (struct)</a></li>
<li><a href="#pcg-advance-function">PCG-ADVANCE (function)</a></li>
<li><a href="#pcg-advance-function_1">PCG-ADVANCE% (function)</a></li>
<li><a href="#pcg-random-function">PCG-RANDOM (function)</a></li>
<li><a href="#pcg-random-function_1">PCG-RANDOM% (function)</a></li>
<li><a href="#pcg-random-bounded-function">PCG-RANDOM-BOUNDED% (function)</a></li>
<li><a href="#pcg-random-float-function">PCG-RANDOM-FLOAT% (function)</a></li>
<li><a href="#pcg-rewind-function">PCG-REWIND (function)</a></li>
<li><a href="#pcg-rewind-function_1">PCG-REWIND% (function)</a></li>
</ul>
</li>
</ul></div>
<h2 id="package-pcg">Package <code>PCG</code></h2>
<h3 id="make-pcg-function"><code>MAKE-PCG</code> (function)</h3>
<div class="codehilite"><pre><span/>(MAKE-PCG &amp;KEY (SEED NIL) (STREAM-ID 0))
</pre></div>


<p>Create and return a new PCG.</p>
<p>If <code>seed</code> is <code>nil</code>, a fresh random seed will be generated with the
  implementation's <code>cl:random</code> function, as if by:</p>
<div class="codehilite"><pre><span/>(random ... (make-random-state t))
</pre></div>


<h3 id="make-pcg-function_1"><code>MAKE-PCG%</code> (function)</h3>
<div class="codehilite"><pre><span/>(MAKE-PCG% SEED STREAM-ID)
</pre></div>


<p>Create and return a new <code>pcg</code> for the given <code>seed</code> and <code>stream-id</code>.</p>
<p>This is a low-level function that assumes you are passing in the correct types.</p>
<h3 id="pcg-struct"><code>PCG</code> (struct)</h3>
<p>Slots: <code>STATE</code>, <code>INCREMENT</code></p>
<h3 id="pcg-advance-function"><code>PCG-ADVANCE</code> (function)</h3>
<div class="codehilite"><pre><span/>(PCG-ADVANCE PCG STEPS)
</pre></div>


<p>Advance the state of <code>pcg</code> by <code>steps</code> steps.</p>
<p>This function returns <code>nil</code> and is only useful for its side effects.</p>
<h3 id="pcg-advance-function_1"><code>PCG-ADVANCE%</code> (function)</h3>
<div class="codehilite"><pre><span/>(PCG-ADVANCE% PCG STEPS)
</pre></div>


<p>Advance the state of <code>pcg</code> by <code>steps</code> steps.</p>
<p>This function returns <code>nil</code> and is only useful for its side effects.</p>
<p>This is a low-level function that assumes you are passing in the correct types.</p>
<h3 id="pcg-random-function"><code>PCG-RANDOM</code> (function)</h3>
<div class="codehilite"><pre><span/>(PCG-RANDOM PCG BOUND &amp;OPTIONAL MAX INCLUSIVE?)
</pre></div>


<p>Generate and return a random number in the specified interval.</p>
<p>If <code>max</code> is omitted the interval will be <code>[0, bound)</code>.</p>
<p>If <code>max</code> is given the interval will be <code>[bound, max)</code>.</p>
<p>If <code>inclusive?</code> is given the interval will be <code>[bound, max]</code>.</p>
<p>If either of <code>bound</code> or <code>max</code> are floats, the result will be a float.
  Otherwise the result will be an integer.</p>
<p>As a side effect, the state of <code>pcg</code> will be advanced.</p>
<h3 id="pcg-random-function_1"><code>PCG-RANDOM%</code> (function)</h3>
<div class="codehilite"><pre><span/>(PCG-RANDOM% PCG)
</pre></div>


<p>Return a random <code>(unsigned-byte 32)</code>.</p>
<p>As a side effect, the state of <code>pcg</code> will be advanced.</p>
<p>This is a low-level function that assumes you are passing in the correct types.</p>
<h3 id="pcg-random-bounded-function"><code>PCG-RANDOM-BOUNDED%</code> (function)</h3>
<div class="codehilite"><pre><span/>(PCG-RANDOM-BOUNDED% PCG BOUND)
</pre></div>


<p>Return a random integer between <code>0</code> (inclusive) and <code>bound</code> (exclusive).</p>
<p>As a side effect, the state of <code>pcg</code> will be advanced.</p>
<p>This is a low-level function that assumes you are passing in the correct types.</p>
<h3 id="pcg-random-float-function"><code>PCG-RANDOM-FLOAT%</code> (function)</h3>
<div class="codehilite"><pre><span/>(PCG-RANDOM-FLOAT% PCG)
</pre></div>


<p>Return a random <code>single-float</code> between <code>0.0</code> and <code>1.0</code>.</p>
<p>As a side effect, the state of <code>pcg</code> will be advanced.</p>
<p>This is a low-level function that assumes you are passing in the correct types.</p>
<h3 id="pcg-rewind-function"><code>PCG-REWIND</code> (function)</h3>
<div class="codehilite"><pre><span/>(PCG-REWIND PCG STEPS)
</pre></div>


<p>Rewind the state of <code>pcg</code> by <code>steps</code> steps.</p>
<p>This function returns <code>nil</code> and is only useful for its side effects.</p>
<h3 id="pcg-rewind-function_1"><code>PCG-REWIND%</code> (function)</h3>
<div class="codehilite"><pre><span/>(PCG-REWIND% PCG STEPS)
</pre></div>


<p>Rewind the state of <code>pcg</code> by <code>steps</code> steps.</p>
<p>This function returns <code>nil</code> and is only useful for its side effects.</p>
<p>This is a low-level function that assumes you are passing in the correct types.</p>
                </div>
            <footer><p><i>Made with Lisp and love by <a href="http://stevelosh.com/">Steve Losh</a> in Reykjavík, Iceland.</i></p>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-15328874-3', 'auto');
  ga('send', 'pageview');

</script></footer>
        </div>
    </body>
</html>