summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-07 15:26:12 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-07 15:26:12 +0100
commitc7fc05f446b4d801038dab1220b5e6173a2c72fc (patch)
tree22a1b5777bb2213da605b8c3ec70fa4f3bcd9662
parent188670069af1432e4d2dc24a9ca6de526ca6bc40 (diff)
downloadwbs-c7fc05f446b4d801038dab1220b5e6173a2c72fc.tar.gz
wbs-c7fc05f446b4d801038dab1220b5e6173a2c72fc.tar.bz2
wbs-c7fc05f446b4d801038dab1220b5e6173a2c72fc.zip
random_choice.pl: Rework to use if-then-else
-rw-r--r--random_choice.pl6
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).