为什么随机在REBOL的GUI中不起作用?

Car*_*orc 5 random user-interface rebol

这个非常简单的脚本:

REBOL []
view layout [
    button "Rand" [alert to-string random 100]
]
Run Code Online (Sandbox Code Playgroud)

给出以下结果:

  • 第一场比赛:95,52,80,96 ......
  • 第二轮:95,52,80,96 ......
  • 第3次跑:95,52,80,96 ......

    ...

这显然不是随机的,因为相同的数字一遍又一遍地重复.

  • 我应该向REBOL网站发布错误报告吗?
  • 有没有一种简单的方法来解决它?

Wis*_*ius 6

听起来你每次运行脚本时都想从一个不同的种子开始.通常,在这些情况下,当前时间用作种子.这与您是否使用GUI无关.

尝试:

REBOL []
random/seed now/precise
view layout [
    button "Rand" [alert to-string random 100]
]
Run Code Online (Sandbox Code Playgroud)