From c7fc05f446b4d801038dab1220b5e6173a2c72fc Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Wed, 7 Nov 2012 15:26:12 +0100 Subject: random_choice.pl: Rework to use if-then-else --- random_choice.pl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'random_choice.pl') diff --git a/random_choice.pl b/random_choice.pl index 43e4735..3bd4a91 100644 --- a/random_choice.pl +++ b/random_choice.pl @@ -1,4 +1,2 @@ -random_choice_do(c,Number):-Number < 0.5,!. -random_choice_do(d,_). - -random_choice(_, Choice, _, _) :- random(Number), random_choice_do(Choice, Number). +random_choice(_, Choice, _, _) :- + random(Number), (Number < 0.5 -> Choice=c ; Choice=d). -- cgit