Documentation Prolog Predicate Reference random random_between/3

random_between/3

Get random integer from range.

Description

random_between( +integer, +integer, ?integer )

random_between(Bottom, Top, Int) succeeds if a randomly chosen integer value between Bottom and Top (inclusive) can unify with Int. The goal will fail if Int is binded to a value which is not the one randomly chosen or if Top is less than Bottom. Please notice that this predicate includes the top boundary in the range, while random/3 excludes it.

Implementation