Public Function RandomLongWithinExpRange( _
Optional ByVal vLower As Variant _
, Optional ByVal vUpper As Variant _
, Optional ByVal vBase As Variant _
) As Variant Rnd(-1) = 0.224007
RandomLongWithinExpRange(1, Null, 3) = 9518240
RandomLongWithinExpRange(1, Null, 3) = 285982127
RandomLongWithinExpRange(1, Null, 3) = 646523244
RandomLongWithinExpRange(1, 100000, 2) = 814
RandomLongWithinExpRange(1, 100000, 2) = 82562
RandomLongWithinExpRange(1, 100000, 2) = 38807Note: 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. RandomLongWithinRange Function
RandomIntegerWithinExpRange FunctionvLower: The lower limit of the range in which the generated random number will fall. vLower defaults to MinLong 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 MaxLong 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.
General Definition:
CLng(Int((dblRnd * (1 + vUpper - vLower) ^ (1 / vBase)) ^ vBase + vLower))
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.