Public Shared Function GetRandomNumber( _ ByVal iLowerBound As Integer, _ ByVal iUpperBound As Integer, _ Optional ByVal iSeedMultiplier As Integer = 1) As Integer Dim Random As New Random(Now.Millisecond * iSeedMultiplier) Return Random.Next(iLowerBound, iUpperBound + 1) End Function Example: For i = 1 To 5 strKey = i.ToString & "|" & GetRandomNumber(1, 10, i).ToString Next