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:
00723477
Views:
7
Add RAND(-1) at the begining of your program to generate random value based on system clock. Othervise VFP generates the same sequence of numbers. The help for RAND() function explains it in details.
RAND(-1)
...
>l_nPickNumber=round(rand()*100,0)
>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!
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform