Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> Visual Basic >> Snippet

Random integer within range


'use Randomize to seed the Rnd function (by default, uses system timer)
Dim iNumber As Long , Upper As Long , Lower As Long
Randomize
iNumber = Int ((Upper - Lower + 1) * Rnd + Lower)