protocol

# randomp

> Random number generator protocol.

author:
  `Paulo Moura`
version:
  `2.0`
date:
  `2016/8/19`

compilation flags:
  `static`

(no dependencies on other files)

## Public interface

### random/1

> Returns a new random float value in the interval [0.0, 1.0[.

compilation flags:
  `static`
template:
  `random(Random)`
mode – number of proofs:
  `random(-float) – one`

### between/3

> Returns a new random integer in the interval [Lower, Upper]. Fails if Lower or Upper are not integers or if Lower > Upper.

compilation flags:
  `static`
template:
  `between(Lower,Upper,Random)`
mode – number of proofs:
  `between(+integer,+integer,-integer) – zero_or_one`

### member/2

> Returns a random member of a list. Fails if the list is empty.

compilation flags:
  `static`
template:
  `member(Random,List)`
mode – number of proofs:
  `member(-term,+list(term)) – zero_or_one`

### select/3

> Returns a random member of a list and the rest of the list. Fails if the list is empty.

compilation flags:
  `static`
template:
  `select(Random,List,Rest)`
mode – number of proofs:
  `select(-term,+list(term),-list(term)) – zero_or_one`

### permutation/2

> Returns a random permutation of a list.

compilation flags:
  `static`
template:
  `permutation(List,Permutation)`
mode – number of proofs:
  `permutation(+list,-list) – one`

### sequence/4

> Returns a list of the given length of random integers in random order in the interval [Lower, Upper]. Fails if Length, Lower, or Upper are not integers or if Lower > Upper.

compilation flags:
  `static`
template:
  `sequence(Length,Lower,Upper,List)`
mode – number of proofs:
  `sequence(+integer,+integer,+integer,-list(integer)) – zero_or_one`

### set/4

> Returns an ordered set of the given size of random integers in the interval [Lower, Upper]. Fails if Length, Lower, or Upper are not integers, if Lower > Upper, or if Length > Upper - Lower + 1.

compilation flags:
  `static`
template:
  `set(Length,Lower,Upper,Set)`
mode – number of proofs:
  `set(+integer,+integer,+integer,-list(integer)) – zero_or_one`

### random/3

> Returns a new random value in the interval [Lower, Upper[. Fails if Lower > Upper. Deprecated. Use between/3 for integers.

compilation flags:
  `static`
template:
  `random(Lower,Upper,Random)`
mode – number of proofs:
  `random(+integer,+integer,-integer) – zero_or_one`
  `random(+float,+float,-float) – zero_or_one`

### randseq/4

> Returns a list of the given length of random values in random order in the interval [Lower, Upper[. Fails if Lower > Upper or if the arguments are neither integers or floats. Deprecated. Use sequence/4 for integers.

compilation flags:
  `static`
template:
  `randseq(Length,Lower,Upper,List)`
mode – number of proofs:
  `randseq(+integer,+integer,+integer,-list(integer)) – zero_or_one`
  `randseq(+integer,+float,+float,-list(float)) – zero_or_one`

### randset/4

> Returns an ordered set of the given size of random values in the interval [Lower, Upper[. Fails if the arguments are neither integers or floats, Lower > Upper, or Length > Upper - Lower when the arguments are integers. Deprecated. Use set/4 for integers.

compilation flags:
  `static`
template:
  `randset(Length,Lower,Upper,Set)`
mode – number of proofs:
  `randset(+integer,+integer,+integer,-list(integer)) – zero_or_one`
  `randset(+integer,+float,+float,-list(float)) – zero_or_one`

### reset_seed/0

> Resets the random generator seed to its default value. Deprecated. Use get_seed/1 and set_seed/1 instead if you need reproducibility.

compilation flags:
  `static`
mode – number of proofs:
  `reset_seed – one`

### get_seed/1

> Gets the current random generator seed. Seed should be regarded as an opaque ground term

compilation flags:
  `static`
template:
  `get_seed(Seed)`
mode – number of proofs:
  `get_seed(-ground) – one`

### set_seed/1

> Sets the random generator seed to a given value returned by calling the get_seed/1 predicate.

compilation flags:
  `static`
template:
  `set_seed(Seed)`
mode – number of proofs:
  `set_seed(+ground) – one`

## Protected interface

(none)

## Private predicates

(none)

## Operators

### (none)

## Remarks

### (none)

## See also

### (none)