jeudi 31 mars 2016

prolog - generate list with random values

I am trying to generate a list with random values between 1 and 10, but when I run the code, I'm receiving "false"...

geraL(0,_).
geraL(C,Y):-
  C is C-1,
  random(1,10,U),
  Y = [U|Y],
  geraL(C,Y).


?-geraL(13,X).




Aucun commentaire:

Enregistrer un commentaire