Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 LPA WIN-PROLOG,我想获得随机值。我寻找了一个随机谓词,但没有找到已经定义的谓词。我尝试了什么:
X is random(10)
random(1,10,X)
有人可以帮我找到获得随机值的方法吗?
谢谢。
LPA Win-Prolog 提供了一个rand/1内置函数和一个seed/1谓词来获取/设置随机数生成器的种子。该rand/1函数返回一个介于零和它的参数之间的浮点数。例如:
rand/1
seed/1
?- seed(42), Random is rand(10).