 
 :: (gamma-random-float<1) ( alpha beta -- n )
     ! Uses ALGORITHM GS of Statistical Computing - Kennedy & Gentle
+    random-generator get :> rnd
     alpha e + e / :> b
 
     0 :> x! 0 :> p! ! initialize locals
     [
         p 1.0 > [
-            random-unit x alpha 1 - ^ >
+            rnd (random-unit) x alpha 1 - ^ >
         ] [
-            random-unit x neg e^ >
+            rnd (random-unit) x neg e^ >
         ] if
     ] [
-        random-unit b * p!
+        rnd (random-unit) b * p!
         p 1.0 <= [
             p 1. alpha / ^
         ] [


! Box-Muller
: poisson-random-float ( mean -- n )
    [ -1 0 ] dip
    [ 2dup < ]
    [ [ 1 + ] 2dip [ random-unit log neg + ] dip ] while 2drop ;

{
    { [ os windows? ] [ "random.windows" require ] }

            [ z log >= ]
        } 1|| not
    ] [
        rnd (random-unit) :> u1
        rnd (random-unit) :> u2

        u1 1. u1 - / log ainv / :> v
        alpha v e^ *            :> x
        u1 sq u2 *              z!
        bbb ccc v * + x -       r!

