WIN-PROLOG - how to get random value?

204 Views Asked by At

I'm using LPA WIN-PROLOG and I want to get random values. I looked for a random predicate and I don't find one that is already defined. What I tried:

X is random(10)

random(1,10,X)

Can someone help me find the way to get a random value?

Thanks.

1

There are 1 best solutions below

0
Paulo Moura On BEST ANSWER

LPA Win-Prolog provides a rand/1 built-in function and a seed/1 predicate to get/set the seed of the random number generator. The rand/1 function returns a float between zero and its argument. For example:

?- seed(42), Random is rand(10).