Function RandomInt() Foundation
Calculate a random numeric value
RandomInt( [<nInt>[,<nInt2>]] ) --> nRand
The parameters determine a range from which a random numeric value is returned. If the function RandomInt() is called without any parameters then the return value is 0 or 1. If only the first parameter is passed then the return value is a numeric value of the range 1 to <nInt>. If the second parameter <nInt2>is passed then the first parameter is mandatory and the return value is of the range <nInt> to <nInt2>.
With the function RandomInt() a numeric value can be calculated that follows stochastic (random) principals. This can be useful to fill database fields with random values and to set up unit tests where coincidence shall play a role.
The algorithm used is based on a pseudo random generator. This kind of generator always creates the same sequence of evenly distributed random numbers when it is initialized with the same seed. However, in Xbase++ the random number generator is automatically initialized on each thread by using the operating system's cryptoprovider.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.