Public Function RandomDoubleWithinExpRange( _ Optional ByVal vLower As Variant _ , Optional ByVal vUpper As Variant _ , Optional ByVal vBase As Variant _ , Optional ByVal vMaxTries As Variant _ ) As Variant
? Rnd(-1) 0.224007 ? RandomDoubleWithinExpRange(0, 10, 3) 4.43227555125717E-02 ? RandomDoubleWithinExpRange(0, 10, 3) 1.33170805171336 ? RandomDoubleWithinExpRange(0, 10, 3) 3.0106084589429 ? RandomDoubleWithinExpRange(-100, 100, 2) -98.3734243672799 ? RandomDoubleWithinExpRange(-100, 100, 2) 65.1220553320519 ? RandomDoubleWithinExpRange(-100, 100, 2) -22.3862675961215 ? RandomDoubleWithinExpRange(Null, Null, 5) 2.97827178053297E+286 ? RandomDoubleWithinExpRange(Null, Null, 5) 7.22218871117141E-113 ? RandomDoubleWithinExpRange(Null, Null, 5) -6.08308655657523E+174Note: The call to the Visual Basic Rnd function in the above example seeds the Visual Basic random number generator so that the sample results can be reproduced. There is generally no need to call the Rnd function within your programs since Entisoft Tools initializes the Visual Basic random number generator once with "Randomize" statement.
RandomDoubleWithinRange Function RandomIntegerWithinExpRange FunctionvLower: The lower limit of the range in which the generated random number will fall. vLower defaults to MinDouble if it is missing or Null or cannot be fixed up to a number.
vUpper: The upper limit of the range in which the generated random number will fall. vUpper defaults to MaxDouble if it is missing or Null or cannot be fixed up to a number.
Function returns Null if vLower > (is greater than) vUpper.
Function returns vLower if vLower = (equals) vUpper.
vBase: See the definition below. vBase defaults to 1 (one) if it is missing or Null or cannot be fixed up to a number. With a vBase of 1 (one), this is the same as calling the RandomDoubleWithinRange function.
vMaxTries: The maximum number of tries to generate a random number within the specified range. vMaxTries defaults to 128 if it is missing or Null or cannot be fixed up to a number. Function returns Null if it still cannot generate a random number within the specified range using the alternate method described in the summary.
General Definition:
dblRnd * (vUpper - vLower) ^ (1 / vBase)) ^ vBase + vLower
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.