ifp ( p true false -- )
Random combinators
Next:whenp ( p true -- )


Vocabulary
combinators.random

Inputs and outputs
pa number between 0 and 1
truea quotation
falsea quotation


Word description
Calls the true quotation with probability p and the false quotation with probability (1-p).

Definition
USING: kernel math random ;

IN: combinators.random

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