5

This very simple script:

REBOL []
view layout [
    button "Rand" [alert to-string random 100]
]

gives the following results:

  • 1-st run: 95, 52, 80, 96 ...
  • 2-nd run: 95, 52, 80, 96 ...
  • 3-rd run: 95, 52, 80, 96 ...

    ...

This is obviously not random because the same numbers repeat over and over again.

  • Should I issue a bug report to the REBOL website?
  • Is there a simple way to fix it?
Caridorc
  • 6,222
  • 2
  • 31
  • 46

2 Answers2

6

It sounds like you'd like to start with a different seed each time you run your script. Typically, the current time is used as a seed in these cases. This has nothing to do with whether you're using the GUI or not.

Try:

REBOL []
random/seed now/precise
view layout [
    button "Rand" [alert to-string random 100]
]
WiseGenius
  • 226
  • 2
  • 9
0

Are you also restarting Rebol? Random gets seeded every first time, so it is not completely surprising to see the same sequence, in such a case.

iArnold
  • 333
  • 2
  • 10