Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Runtime vs Development Coding
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00723472
Message ID:
00723475
Views:
9
This message has been marked as the solution to the initial question of the thread.
>Hello all,
>
>I have a splash screen that is instantiated in my main prg file:
>
>SET CLASSLIB TO qdmsabout ADDITIVE
>phil = CREATEOBJ('qdms_splash')
>phil.SHOW(1)
>
>In the load of the splash screen, I open a table of quotations, set the order to quote number, and then generate a random number:
>
>l_nPickNumber=round(rand()*100,0)
>
>The table is then selected and the record number is found with a seek.
>
>In the init, I display the corresponding quote:
>
>thisform.edbThought.value=alltrim(thoughts.thought)
>
>All works well in the development environment, but when run as an exe, the PickNumber is ALWAYS 85! I can also use l_nPickNumber=8 (or any number) and it finds the corresponding record.
>
>Why is the RAND statement not working in the exe?
>
>Thanks!


Seed Rand() with a -1 before calling it. This will make it random all the time.
IF you closed your developement environment and called it, in that order each time you will note that it always is the same.

Try:
rand(-1)
l_nPickNumber=round(rand()*100,0)

Tracy
Tracy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform