Logtalk 2.30.1 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1903 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
19
Logtalk/examples/threads/sorting/generator.lgt
Normal file
19
Logtalk/examples/threads/sorting/generator.lgt
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
:- 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.
|
||||
Reference in New Issue
Block a user