Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need suggestions for not so random number
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01084023
Message ID:
01084110
Views:
9
>I am looking for suggestions for the following algorithm:
>
>Say I have a “seed” number (or string of digits or letters). E.g. “382622” (does not matter how many digits, so if you think it should be a certain number of digits, please let me know). This “seed” number will never change.
>
>Then I want to generate a number or a string of digits (or letters) that I can “equate” to the above mentioned “seed” number. And I want the generated number or string to be different every time I “request” it. The key is that the newly generated number or string can be equated to the "seed" number. It can be "equated" via a formula or a function or whatever.
>
>I hope I am clear in my explanation.
>
>Thank you in advance for any suggestions.

Dmitry,

I think Sergey's link is the best for what you are looking for, but, to answer (I hope!) your question, if you call Rand(382622) it will always return the same number, furthermore, all subsequent calls to rand() will follow the same pattern, for example:
? rand(382622) && 0.74
? rand() && .66
? rand() && .46
? rand() && .21
? rand(382622) && 0.74
? rand() && .66
? rand() && .46
? rand() && .21
And this will have the same values in any machine, AFAIK
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform