9c78e1a01787

roul: Update site.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 08 Nov 2012 12:55:55 -0500
parents 531f67eec776
children 09f9090300b4
branches/tags (none)
files roul/index.html roul/installation/index.html roul/usage/index.html

Changes

--- a/roul/index.html	Fri Sep 07 14:10:14 2012 -0400
+++ b/roul/index.html	Thu Nov 08 12:55:55 2012 -0500
@@ -34,7 +34,7 @@
     t.type  = 'text/javascript';
     t.async = true;
     t.id    = 'gauges-tracker';
-    t.setAttribute('data-site-id', '4f843f8c613f5d65280000e6');
+    t.setAttribute('data-site-id', '4f80ace2f5a1f538860000c2');
     t.src = '//secure.gaug.es/track.js';
     var s = document.getElementsByTagName('script')[0];
     s.parentNode.insertBefore(t, s);
--- a/roul/installation/index.html	Fri Sep 07 14:10:14 2012 -0400
+++ b/roul/installation/index.html	Thu Nov 08 12:55:55 2012 -0500
@@ -4,7 +4,7 @@
             <header><h1><a href="..">Roul</a></h1></header><div class="markdown">
 <h1 id="installation"><a href="">Installation</a></h1><p>Roul requires Leiningen 2.  Sorry.</p>
 <p>Add the following to your <code>project.clj</code>:</p>
-<div class="codehilite"><pre><span class="p">[</span><span class="n">roul</span> <span class="s">"0.1.0"</span><span class="p">]</span>
+<div class="codehilite"><pre><span class="p">[</span><span class="n">roul</span> "0<span class="p">.</span>2<span class="p">.</span>0"<span class="p">]</span>
 </pre></div>
 
 
@@ -20,7 +20,7 @@
     t.type  = 'text/javascript';
     t.async = true;
     t.id    = 'gauges-tracker';
-    t.setAttribute('data-site-id', '4f843f8c613f5d65280000e6');
+    t.setAttribute('data-site-id', '4f80ace2f5a1f538860000c2');
     t.src = '//secure.gaug.es/track.js';
     var s = document.getElementsByTagName('script')[0];
     s.parentNode.insertBefore(t, s);
--- a/roul/usage/index.html	Fri Sep 07 14:10:14 2012 -0400
+++ b/roul/usage/index.html	Thu Nov 08 12:55:55 2012 -0500
@@ -9,6 +9,9 @@
 <li><a href="#rand-int">rand-int</a></li>
 <li><a href="#rand-nth">rand-nth</a></li>
 <li><a href="#rand-nth-weighted">rand-nth-weighted</a></li>
+<li><a href="#rand-bool">rand-bool</a></li>
+<li><a href="#rand-gaussian">rand-gaussian</a></li>
+<li><a href="#rand-gaussian-int">rand-gaussian-int</a></li>
 </ul></li>
 </ul></div>
 <h2 id="roulrandom">roul.random</h2>
@@ -17,12 +20,12 @@
 functions of its own.</p>
 <p>The recommended way is to <code>require</code> this namespace into your own instead of
 overwriting Clojure's builtins:</p>
-<div class="codehilite"><pre><span class="p">(</span><span class="nf">ns</span> <span class="nv">foo</span><span class="o">.</span><span class="nv">core</span>
-  <span class="p">(</span><span class="nf">:require</span> <span class="p">[</span><span class="nv">roul</span><span class="o">.</span><span class="nv">random</span> <span class="nv">:as</span> <span class="nv">rr</span><span class="p">]))</span>
+<div class="codehilite"><pre><span class="p">(</span><span class="kd">ns </span><span class="nv">foo.core</span>
+  <span class="p">(</span><span class="ss">:require</span> <span class="p">[</span><span class="nv">roul.random</span> <span class="ss">:as</span> <span class="nv">rr</span><span class="p">]))</span>
 
 <span class="c1">; or</span>
 
-<span class="p">(</span><span class="nf">require</span> <span class="o">'</span><span class="p">[</span><span class="nv">roul</span><span class="o">.</span><span class="nv">random</span> <span class="nv">:as</span> <span class="nv">rr</span><span class="p">])</span>
+<span class="p">(</span><span class="nf">require</span> <span class="o">'</span><span class="p">[</span><span class="nv">roul.random</span> <span class="ss">:as</span> <span class="nv">rr</span><span class="p">])</span>
 </pre></div>
 
 
@@ -65,11 +68,70 @@
 weights can be arbitrary numbers -- they do not need to add up to anything
 specific.</p>
 <div class="codehilite"><pre><span class="c1">; Returns coffee roughly 80% of the time, tea 15%, and soda 5%.</span>
-<span class="p">(</span><span class="nf">rr/rand-nth-weighted</span> <span class="p">{</span><span class="nv">:coffee</span> <span class="mf">0.80</span><span class="o">,</span> <span class="nv">:tea</span> <span class="mf">0.15</span><span class="o">,</span> <span class="nv">:soda</span> <span class="mf">0.05</span><span class="p">})</span>
+<span class="p">(</span><span class="nf">rr/rand-nth-weighted</span> <span class="p">{</span><span class="ss">:coffee</span> <span class="mf">0.80</span>, <span class="ss">:tea</span> <span class="mf">0.15</span>, <span class="ss">:soda</span> <span class="mf">0.05</span><span class="p">})</span>
 
 <span class="c1">; Returns cats roughly twice as often as boots.</span>
-<span class="p">(</span><span class="nf">rr/rand-nth-weighted</span> <span class="p">[[</span><span class="nv">:boots</span> <span class="mi">14</span><span class="p">]</span>
-                       <span class="p">[</span><span class="nv">:cats</span> <span class="mi">28</span><span class="p">]])</span>
+<span class="p">(</span><span class="nf">rr/rand-nth-weighted</span> <span class="p">[[</span><span class="ss">:boots</span> <span class="mi">14</span><span class="p">]</span>
+                       <span class="p">[</span><span class="ss">:cats</span> <span class="mi">28</span><span class="p">]])</span>
+</pre></div>
+
+
+<h3 id="rand-bool">rand-bool</h3>
+<div class="codehilite"><pre><span class="p">(</span><span class="nf">rand-bool</span><span class="p">)</span>         <span class="c1">; return true or false</span>
+<span class="p">(</span><span class="nf">rand-bool</span> <span class="nv">percent</span><span class="p">)</span> <span class="c1">; return true the given percent of the time, false the rest</span>
+</pre></div>
+
+
+<p>Returns <code>true</code> or <code>false</code> randomly.</p>
+<p><code>percent</code> can be an integer or a float like <code>20</code> or <code>39.2</code>.  If given, <code>true</code>
+will be returned that percent of the time (and <code>false</code> the rest).</p>
+<p>If percent is not given it defaults to <code>50</code> (an equal chance for <code>true</code> and
+<code>false</code>).</p>
+<h3 id="rand-gaussian">rand-gaussian</h3>
+<div class="codehilite"><pre><span class="p">(</span><span class="nf">rand-gaussian</span><span class="p">)</span>
+<span class="p">(</span><span class="nf">rand-gaussian</span> <span class="nv">mean</span> <span class="nv">standard-deviation</span><span class="p">)</span>
+<span class="p">(</span><span class="nf">rand-gaussian</span> <span class="nv">mean</span> <span class="nv">standard-deviation</span> <span class="nv">upper-bound</span> <span class="nv">lower-bound</span><span class="p">)</span>
+</pre></div>
+
+
+<p>Return a random float taken from a Gaussian distribution with the given mean and
+standard deviation.</p>
+<p><code>mean</code> defaults to 0.</p>
+<p><code>standard-deviation</code> defaults to 1.</p>
+<p>A lower and upper bound can be specified if desired, which will clamp the output
+of this function to those bounds.  Note that this clamping does NOT adjust the
+distribution, so if you clamp too tightly you'll get a disproportionate number
+of the boundary values.  It's just here to give you a way to prevent garbage
+values.</p>
+<div class="codehilite"><pre><span class="c1">; Generate an [x, y] pair with Gaussian-distributed values.</span>
+<span class="c1">; The x value here is clamped between 0 and graph-width.</span>
+<span class="p">(</span><span class="k">let </span><span class="p">[</span><span class="nv">x</span> <span class="p">(</span><span class="nf">rand-gaussian</span> <span class="mi">100</span> <span class="mi">20</span> <span class="mi">0</span> <span class="nv">graph-width</span><span class="p">)</span>
+      <span class="nv">y</span> <span class="p">(</span><span class="nf">rand-gaussian</span> <span class="mi">200</span> <span class="mi">40</span><span class="p">)]</span>
+  <span class="nv">...</span><span class="p">)</span>
+</pre></div>
+
+
+<h3 id="rand-gaussian-int">rand-gaussian-int</h3>
+<div class="codehilite"><pre><span class="p">(</span><span class="nf">rand-gaussian</span><span class="p">)</span>
+<span class="p">(</span><span class="nf">rand-gaussian</span> <span class="nv">mean</span> <span class="nv">standard-deviation</span><span class="p">)</span>
+<span class="p">(</span><span class="nf">rand-gaussian</span> <span class="nv">mean</span> <span class="nv">standard-deviation</span> <span class="nv">upper-bound</span> <span class="nv">lower-bound</span><span class="p">)</span>
+</pre></div>
+
+
+<p>Return a random int taken from a Gaussian distribution with the given mean and
+standard deviation.</p>
+<p><code>mean</code> defaults to 0.</p>
+<p><code>standard-deviation</code> defaults to 1.</p>
+<p>A lower and upper bound can be specified if desired, which will clamp the output
+of this function to those bounds.  Note that this clamping does NOT adjust the
+distribution, so if you clamp too tightly you'll get a disproportionate number
+of the boundary values.  It's just here to give you a way to prevent garbage
+values.</p>
+<div class="codehilite"><pre><span class="c1">; Generate an [x, y] pair with Gaussian-distributed values.</span>
+<span class="c1">; The x value here is clamped between 0 and graph-width.</span>
+<span class="p">(</span><span class="k">let </span><span class="p">[</span><span class="nv">x</span> <span class="p">(</span><span class="nf">rand-gaussian</span> <span class="mi">100</span> <span class="mi">20</span> <span class="mi">0</span> <span class="nv">graph-width</span><span class="p">)</span>
+      <span class="nv">y</span> <span class="p">(</span><span class="nf">rand-gaussian</span> <span class="mi">200</span> <span class="mi">40</span><span class="p">)]</span>
+  <span class="nv">...</span><span class="p">)</span>
 </pre></div>
                 </div>
             <footer><p>Created by <a href="http://stevelosh.com">Steve Losh</a>.
@@ -82,7 +144,7 @@
     t.type  = 'text/javascript';
     t.async = true;
     t.id    = 'gauges-tracker';
-    t.setAttribute('data-site-id', '4f843f8c613f5d65280000e6');
+    t.setAttribute('data-site-id', '4f80ace2f5a1f538860000c2');
     t.src = '//secure.gaug.es/track.js';
     var s = document.getElementsByTagName('script')[0];
     s.parentNode.insertBefore(t, s);