The evaluable functions random/0 and random/1 generate uniformly
distributed members of the arithmetic domains. Each knowledge base
has its own pre-allocated random number generator which can be
accessed concurrently. Random number generator objects can be
created with the predicates random_new/1 and random_new/2.

random --> 0.6011883752343405

random(100) --> 61

The result type of the evaluable function random/0 is always a
Prolog float, which amounts to a Java double. The result type of
the evaluable function random/1 reflects the type of the argument.
The predicates random_next/2 and random_next/3 do the same, except
that they take an additional random number generator object as a
first parameter.

The predicate ticket_new/1 can be used to create a counter whch will be initialized to zero. The counter can then be incremented via the predicate counter_next/2 whereby the old value is returned. The later predicate is implemented with the help of an atomic integer.

The following random numbers evaluable functions are provided:

- random(F):
- The predicate succeeds for a continuous uniform random number F in the interval [0..1) from the knowledgebase random number generator.
- random(M, N):
- The predicate succeeds for a uniform random number N in the interval [0..M) for M>0 from the knowledgebase random number generator. The distribution is discrete when M is discrete and continuous otherwise.

The following random numbers evaluable functions are provide:

**random_new(R):**- The predicate succeeds for a new random number generator R with a randomized seed.
**random_new(S, R):**- The predicate succeeds for a new random number generator R with seed S.
**random_next(R, F):**- The predicate succeeds for a continuous uniform random number F in the interval [0..1) from the random number generator R.
**random_next(R, M, N):**- The predicate succeeds for a uniform random number N in the interval [0..M) for M>0 from the random number generator R. The distribution is discrete when M is discrete and continuous otherwise.
**counter_new(C):**- The predicate succeeds for a new counter C.
**counter_next(C, V):**- The predicate succeeds for incrementing the counter C and unifying the old value V.
**random_permutation(L, R):****random_permutation(G, L, R):**- The predicate succeeds in R with a random permutation of L. The ternary predicate allows specifying a random generator G.

The following random number Prolog flags are provided:

**sys_random:**- Legal values are instances of the Java class java.util.Random. The flag is the random number generator for the knowledge base. The flag can be changed.