 
 ! Box-Muller
 : poisson-random-float ( mean -- n )
-    [ -1 0 ] dip
-    [ 2dup < ]
-    [ [ 1 + ] 2dip [ random-unit log neg + ] dip ] while 2drop ;
+    [ -1 0 ] dip [ 2dup < ] random-generator get '[
+        [ 1 + ] 2dip [ _ (random-unit) log neg + ] dip
+    ] while 2drop ;
 
 {
     { [ os windows? ] [ "random.windows" require ] }

    ! Uses R.C.H. Cheng, "The generation of Gamma
    ! variables with non-integral shape parameters",
    ! Applied Statistics, (1977), 26, No. 1, p71-74
    2. alpha * 1 - sqrt :> ainv
    alpha 4. log -      :> bbb
    alpha ainv +        :> ccc

    0 :> r! 0 :> z! 0 :> result! ! initialize locals
    [


        0 :> c! 0 :> _f! ! initialize locals
        [
            rnd (random-unit) {
                [ 2. c - c * < ] [ 1. c - e^ c * <= ]
            } 1|| not
        ] [
            rnd (random-unit) pi * cos :> z
            r z * 1. + r z + /   _f!
            r _f - kappa *       c!
        ] do while

        mu 2pi mod _f cos
        rnd (random-unit) 0.5 > [ + ] [ - ] if
    ] if ;

:: (triangular-random-float) ( low high mode -- n )
