>>Hello,
>>
>>I'm having a problem with Rand(): after starting the application, it always generates the same Rand() values.
>>
>>How can I get really random values in VFP?
>
>James Blackburn gave you the answer, but I want to add some theory. Really random numbers are rarely used on computers, because that would require special hardware (for example, detect the decay of radioactive isotopes, or amplify random electrical noise in a wire). Instead, so-called pseudo-random numbers are usually used, and they are appropriate for many applications. In these, each number in a "random" sequence is actually calculated on the basis of the previous one - therefore you get the same sequence every time. The complete sequence can go through thousands or perhaps even millions of numbers before repeating, and the function is chosen so that the result "looks random".
>
>rand(-1) will "seed" the random number generator, basing it on the current time. Since this will not be the same the next time you run your program, you will get a different sequence.
Thanks for the explanation, this really helps me undestand why I need to do the seed. I was already wondering.
Christian Isberner
Software Consultant