diff options
-rw-r--r-- | random_choice.pl | 6 |
1 files changed, 2 insertions, 4 deletions
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). |