- Mark Jones
- PowerBuilder
- Monday, 18 January 2021 10:45 PM UTC
It appears that some care is needed with the Randomize(0) function when used in the application startup event.
We have reproduced that in PB 2019 4017 that the setting of the random number sequence can end up being reset.
We have an application startup script that calls various other functions, early on in the script we call randomize(0) (which should set the random number based on the system clock) however later on the script the random number gets reset to the same point in the pseudo-random sequence.
If we call randomize(0) again later in the script then we end up again with a random number seeded by the system clock. There is a specific line in the script that calls a function that does relatively little - any randomize(0) before the call is reset, randomize(0) after the call works. Interestingly randomize(0) on the last line of the function will also get reset. It might be a memory or corruption issue but one to look out for! It might be a bug but I cannot be sure about this...
Mark
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.