erlang Pred = fun (DiceRoll) -> DiceRoll =/= 6 end,
Action = fun (DiceRoll) -> io:format("~B,", [DiceRoll]), dice_roll() end,
do_while(Pred, Action, dice_roll()).
-module(do_while).
-export([start/0]).
start() ->
setRNG(),
Pred = fun (DiceRoll) -> DiceRoll =/= 6 end,
Action = fun (DiceRoll) -> io:format("~B,", [DiceRoll]), dice_roll() end,
do_while(Pred, Action, dice_roll()).
setRNG() -> {A1, A2, A3} = now(), random:seed(A1, A2, A3).
dice_roll() -> 1 + random:uniform(6 - 1).