root/trunk/library/randomp.lgt

Revision 4552, 1.8 KB (checked in by pmoura, 3 weeks ago)

Added synchronized/1 directives to the predicates declared in the "randomp" library protocol.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1
2:- protocol(randomp).
3
4    :- info([
5        version is 1.1,
6        author is 'Paulo Moura',
7        date is 2008/10/31,
8        comment is 'Random number generator protocol.']).
9
10    :- public(random/1).
11    :- synchronized(random/1).
12    :- mode(random(-float), one).
13    :- info(random/1, [
14        comment is 'Returns a new random float value in the interval [0.0, 1.0[.',
15        argnames is ['Random']]).
16
17    :- public(random/3).
18    :- synchronized(random/3).
19    :- mode(random(+integer, +integer, -integer), zero_or_one).
20    :- mode(random(+float, +float, -float), zero_or_one).
21    :- info(random/3, [
22        comment is 'Returns a new random value in the interval [Lower, Upper[.',
23        argnames is ['Lower', 'Upper', 'Random']]).
24
25    :- public(randseq/4).
26    :- synchronized(randseq/4).
27    :- mode(randseq(+integer, +integer, +integer, -list(integer)), zero_or_one).
28    :- mode(randseq(+integer, +float, +float, -list(float)), zero_or_one).
29    :- info(randseq/4, [
30        comment is 'Returns a list of Length random values in the interval [Lower, Upper[.',
31        argnames is ['Length', 'Lower', 'Upper', 'List']]).
32
33    :- public(randset/4).
34    :- synchronized(randset/4).
35    :- mode(randset(+integer, +integer, +integer, -list(integer)), zero_or_one).
36    :- mode(randset(+integer, +float, +float, -list(float)), zero_or_one).
37    :- info(randset/4, [
38        comment is 'Returns an ordered set of Length random values in the interval [Lower, Upper[.',
39        argnames is ['Length', 'Lower', 'Upper', 'Set']]).
40
41    :- public(reset_seed/0).
42    :- synchronized(reset_seed/0).
43    :- mode(reset_seed, one).
44    :- info(reset_seed/0, [
45        comment is 'Resets the random seed to its default value.']).
46
47    :- public(set_seed/1).
48    :- synchronized(set_seed/1).
49    :- mode(set_seed(+integer), zero_or_one).
50    :- info(set_seed/1, [
51        comment is 'Sets the random seed to the given value.',
52        argnames is ['Seed']]).
53
54:- end_protocol.
Note: See TracBrowser for help on using the browser.