Skip to main content
NetworkAdminKB Logo

VBScript Library

Go Search
NetworkAdminKB.com
Knowledge Base
VBScript Library
Utilities
  
NetworkAdminKB.com > VBScript Library > Knowledge Base > RandomRange  

RandomRange

Article Content

'********************************************************************

'*

'* Function RandomRange

'*

'*   Author: NetworkAdminKB.com

'*  Created: 2004-11-22

'* Modified: 2004-11-22

'*

'* Purpose: Returns a random number within the range specified.

'*

'*   Input: intLo = The Lowest Number in the Range.

'*          intHi = The Highest Number in the Range.

'*

'*  Output: Returns a random number within the range specified.

'*          Returns Empty if either intLo or intHi is not a Number.

'*

'********************************************************************

Function RandomRange(ByVal intLo, ByVal intHi)

  'Version 1.0 2004-11-22

  Randomize

  If IsNumeric(intLo) And IsNumeric(intHi) Then

    RandomRange = Int((intHi - intLo + 1) * Rnd + intLo)

  Else

    RandomRange = Empty

  End If 'IsNumeric(intLo) and IsNumeric(intHi)

End Function 'RandomRange

Keywords
Math Function 
Related Articles
 
Last modified at 2/12/2009 7:53 PM  by TEMPLATE\kbadmin 
 
 NetworkAdminKB.com
 Copyright © 2008 NetworkAdminKB.com, All rights reserved. Terms of Use | Contact US