| || |
some random number functions
The attached ZIP file contains a compiled module with some
random number functions which have proven useful to randomize
my testing alogorithms:
gRandInt() returns a random positive integer between 0 and iMax.
gRandRange() returns a random positive integer between i1 and i2.
gRandArray() initializes an array of randomized positive integers
between i1 and i2.
gSetRandSeed() seeds the random number generator used by the
above functions. This call logs the specified seed value in the
gRandArray() is particularily useful for radomizing the accesses
into a Data Table, while ensuring that none of the selected
accesses are repeated. [i.e. you pass gRandArray() the values
of 1 and Data Table Size+1, and it will return those range
of values--radomized--in your out Array. You then iterate on
the out Array values to access your Data Table entries].
gSetRandSeed() should be called when a test is started to "seed"
WinRunner's random number generator; this value will be logged
in the results, so if you want to reproduce the exact random
number accesses later you can force the test to use a specific
seed value [presumably in a test which kicked up some bugs].
Hopefully some of you will find these functions useful.
<LI> Terry Horwath