
 random.pl -- Random numbers
random.pl -- Random numbersThis library is derived from the DEC10 library random. Later, the core random generator was moved to C. The current version uses the SWI-Prolog arithmetic functions to realise this library. These functions are based on the GMP library.
 random(-R:float) is det
 random(-R:float) is det random_between(+L:int, +U:int, -R:int) is semidet
 random_between(+L:int, +U:int, -R:int) is semidet random(+L:int, +U:int, -R:int) is det
 random(+L:int, +U:int, -R:int) is det setrand(+State) is det
 setrand(+State) is det getrand(-State) is det
 getrand(-State) is det
For compatibility reasons with older versions of this library,
setrand/1 also accepts a term rand(A,B,C), where A, B and C are
integers in the range 1..30,000. This argument is used to seed
the random generator. Deprecated.
 maybe is semidet
 maybe is semidet maybe(+P) is semidet
 maybe(+P) is semidet maybe(+K, +N) is semidet
 maybe(+K, +N) is semidet random_perm2(?A, ?B, ?X, ?Y) is semidet
 random_perm2(?A, ?B, ?X, ?Y) is semidet random_member(-X, +List:list) is semidet
 random_member(-X, +List:list) is semidet random_select(-X, +List, -Rest) is semidet
 random_select(-X, +List, -Rest) is semidet random_subseq(+List, -Subseq, -Complement) is det
 random_subseq(+List, -Subseq, -Complement) is detrandom_subseq/3 may also be called with Subseq and Complement bound and List unbound, which will recreate List by randomly interleaving Subseq and Complement. This mode may fail randomly, matching SICStus behavior. The failure probability corresponds to the probability of the "forward" mode selecting a Subseq/Complement combination with different lengths.
 randset(+K:int, +N:int, -S:list(int)) is det
 randset(+K:int, +N:int, -S:list(int)) is det?- randset(5, 5, S). S = [1, 2, 3, 4, 5]. (always) ?- randset(5, 20, S). S = [2, 7, 10, 19, 20].
 randseq(+K:int, +N:int, -List:list(int)) is det
 randseq(+K:int, +N:int, -List:list(int)) is det
randseq(K, N, List) :-
      randset(K, N, Set),
      random_permutation(Set, List).
 random_permutation(+List, -Permutation) is det
 random_permutation(+List, -Permutation) is det random_numlist(+P, +L, +U, -List) is det
 random_numlist(+P, +L, +U, -List) is detThe following predicates are exported, but not or incorrectly documented.
 getrand(Arg1)
 getrand(Arg1)