|Did you know ...||Search Documentation:|
|library(random): Random numbers|
This 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.
For compatibility reasons with older versions of this library,
setrand/1 also accepts
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.
|), followed by nth1/3. Fails of List is the empty list.
|is K. For a large K/N it enumerates 1..N and decides randomly to include the number or not. For example:
?- randset(5, 5, S). S = [1, 2, 3, 4, 5]. (always) ?- randset(5, 20, S). S = [2, 7, 10, 19, 20].
randseq(K, N, List) :- randset(K, N, Set), random_permutation(Set, List).