a7cfc6e799
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1859 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
20 lines
328 B
Plaintext
20 lines
328 B
Plaintext
|
|
:- 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.
|