# HG changeset patch # User Steve Losh # Date 1352397355 18000 # Node ID 9c78e1a01787ded6ecc0ab378e5286ed20bad233 # Parent 531f67eec7767ae4b0f13ef56f48517f1f7bb498 roul: Update site. diff -r 531f67eec776 -r 9c78e1a01787 roul/index.html --- 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); diff -r 531f67eec776 -r 9c78e1a01787 roul/installation/index.html --- 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 @@

Roul

Installation

Roul requires Leiningen 2. Sorry.

Add the following to your project.clj:

-
[roul "0.1.0"]
+
[roul "0.2.0"]
 
@@ -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); diff -r 531f67eec776 -r 9c78e1a01787 roul/usage/index.html --- 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 @@
  • rand-int
  • rand-nth
  • rand-nth-weighted
  • +
  • rand-bool
  • +
  • rand-gaussian
  • +
  • rand-gaussian-int
  • roul.random

    @@ -17,12 +20,12 @@ functions of its own.

    The recommended way is to require this namespace into your own instead of overwriting Clojure's builtins:

    -
    (ns foo.core
    -  (:require [roul.random :as rr]))
    +
    (ns foo.core
    +  (:require [roul.random :as rr]))
     
     ; or
     
    -(require '[roul.random :as rr])
    +(require '[roul.random :as rr])
     
    @@ -65,11 +68,70 @@ weights can be arbitrary numbers -- they do not need to add up to anything specific.

    ; Returns coffee roughly 80% of the time, tea 15%, and soda 5%.
    -(rr/rand-nth-weighted {:coffee 0.80, :tea 0.15, :soda 0.05})
    +(rr/rand-nth-weighted {:coffee 0.80, :tea 0.15, :soda 0.05})
     
     ; Returns cats roughly twice as often as boots.
    -(rr/rand-nth-weighted [[:boots 14]
    -                       [:cats 28]])
    +(rr/rand-nth-weighted [[:boots 14]
    +                       [:cats 28]])
    +
    + + +

    rand-bool

    +
    (rand-bool)         ; return true or false
    +(rand-bool percent) ; return true the given percent of the time, false the rest
    +
    + + +

    Returns true or false randomly.

    +

    percent can be an integer or a float like 20 or 39.2. If given, true +will be returned that percent of the time (and false the rest).

    +

    If percent is not given it defaults to 50 (an equal chance for true and +false).

    +

    rand-gaussian

    +
    (rand-gaussian)
    +(rand-gaussian mean standard-deviation)
    +(rand-gaussian mean standard-deviation upper-bound lower-bound)
    +
    + + +

    Return a random float taken from a Gaussian distribution with the given mean and +standard deviation.

    +

    mean defaults to 0.

    +

    standard-deviation defaults to 1.

    +

    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.

    +
    ; Generate an [x, y] pair with Gaussian-distributed values.
    +; The x value here is clamped between 0 and graph-width.
    +(let [x (rand-gaussian 100 20 0 graph-width)
    +      y (rand-gaussian 200 40)]
    +  ...)
    +
    + + +

    rand-gaussian-int

    +
    (rand-gaussian)
    +(rand-gaussian mean standard-deviation)
    +(rand-gaussian mean standard-deviation upper-bound lower-bound)
    +
    + + +

    Return a random int taken from a Gaussian distribution with the given mean and +standard deviation.

    +

    mean defaults to 0.

    +

    standard-deviation defaults to 1.

    +

    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.

    +
    ; Generate an [x, y] pair with Gaussian-distributed values.
    +; The x value here is clamped between 0 and graph-width.
    +(let [x (rand-gaussian 100 20 0 graph-width)
    +      y (rand-gaussian 200 40)]
    +  ...)