4744b5c5d33d

Add `random-gaussian-integer`
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Wed, 10 Aug 2016 02:10:26 +0000
parents 5502971bb4bb
children 2991413e9fa6
branches/tags (none)
files losh.lisp package.lisp

Changes

--- a/losh.lisp	Wed Aug 10 01:57:01 2016 +0000
+++ b/losh.lisp	Wed Aug 10 02:10:26 2016 +0000
@@ -155,6 +155,10 @@
                     spare (* v s))
               (return (scale (* u s))))))))
 
+(defun random-gaussian-integer (&optional (mean 0) (standard-deviation 1))
+  "Return a random integer from a gaussian distribution.  NOT THREAD-SAFE (yet)!"
+  (round (random-gaussian mean standard-deviation)))
+
 
 (defun d (n sides &optional (plus 0))
   "Roll some dice.
--- a/package.lisp	Wed Aug 10 01:57:01 2016 +0000
+++ b/package.lisp	Wed Aug 10 02:10:26 2016 +0000
@@ -21,6 +21,7 @@
     #:random-range-exclusive
     #:random-around
     #:random-gaussian
+    #:random-gaussian-integer
     #:d
 
     #:juxt