The generalized formula is

VB Code:
  1. Int((upperbound - lowerbound + 1) * Rnd + lowerbound)