-1

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.

STF
  • 1,485
  • 3
  • 19
  • 36
  • 1
    This is a commercial product without a public manual. Perhaps you could email them and get support that way? If I were guessing, I would try `X is random()` and hope to get back a float value between 0 and 1. – Daniel Lyons Oct 17 '18 at 06:19
  • @DanielLyons , thanks but it doesn't work. – STF Oct 17 '18 at 09:13

1 Answers1

1

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).
Paulo Moura
  • 18,373
  • 3
  • 23
  • 33