jeudi 8 octobre 2015

YAP Prolog random's lack of randomness

When executing the following Prolog program with YAP, the output is always the same, namely the integer 233.

:- use_module(library(random)).    
x:- random(1,1000,X), writeln(X).

For instance, if I execute the following bash script, the output is always the same integer (233).

for k in `seq 0`
do
  yap -l test.pl << %
  x.
%
done

If I repeat this procedure using swipl, then the output is different each time, i.e random.

Can anyone explain this?




Aucun commentaire:

Enregistrer un commentaire