 
 : call-random>casep ( seq -- assoc )
     [ length recip ] keep [ 2array ] with map ;
-    
+
 PRIVATE>
 
 MACRO: casep ( assoc -- ) casep>quot ;


M: bad-probabilities summary
    drop "The probabilities do not satisfy the rules stated in the docs." ;
    
: good-probabilities? ( assoc -- ? )
    dup last pair? [
        keys { [ sum 1 number= ] [ [ 0 1 between? ] all? ] } 1&&

IN: combinators.random

: ifp ( p true false -- ) [ random-unit > ] 2dip if ; inline

: whenp ( p true -- ) [ ] ifp ; inline

: unlessp ( p false -- ) [ [ ] ] dip ifp ; inline

<PRIVATE
