[ library(tentative) | Reference Manual | Alphabetic Index ]

# vs_random_index(+VS, -I)

Retrieve a random variable index from a varset

VS
  A varset
I
  An integer (output)

## Description

Retrieve a random variable index from a varset.

### Modes and Determinism

- vs_random_index(+, -) is semidet

## Examples

        ?- Vars=[A,B,C], tent_set(Vars, [a,b,c]), vs_create(Vars, VS),
           vs_random_index(VS, I).
        Vars = [A{a -> 0}, B{b -> 0}, C{c -> 0}]
        VS = ...
        I = 1		% 1, 2 or 3, the result is random!
        Yes (0.00s cpu)

## See Also

vs_create / 2, vs_element / 3, vs_random / 2