This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/Logtalk/examples/threads/sorting/generator.lgt

20 lines
328 B
Plaintext
Raw Normal View History

:- object(generator).
:- info([
version is 1.0,
author is 'Paulo Moura',
date is 2007/03/22,
comment is 'Simple object defining a predicate for generating lists of random values.']).
:- public(list/2).
list(0, []).
list(N, [R| Rs]) :-
N > 0,
N2 is N - 1,
random::random(R),
list(N2, Rs).
:- end_object.