Public Function RandomLongWithinRangeFast( _ ByRef rLower As Long _ , ByRef rUpper As Long _ ) As Long
Rnd(-1) = 0.224007 RandomLongWithinRangeFast(1, MaxLong) = 76978304 RandomLongWithinRangeFast(1, MaxLong) = 185440256 RandomLongWithinRangeFast(1, MaxLong) = 352754048 RandomLongWithinRangeFast(1, 100000) = 17974 RandomLongWithinRangeFast(1, 100000) = 57321 RandomLongWithinRangeFast(1, 100000) = 51067Note: 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 RandomLongGenerator Function Rnd Function (Visual Basic)rLower: The lower limit of the range in which the generated random number will fall. This argument is never modified even though it is passed by-reference.
Int(Rnd * (1 + rUpper - rLower) + rLower)Note: Some random Long values may not possibly be generated when the range between vLower and vUpper is very large; the RandomLongWithinRange function handles this case better but is slower.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.