Free Random Number Generator

Here is what the program looks like:

screenshot of program

To use it, simply input a number in the top box and click "GO!" A random number between 1 and the number you entered on top will appear in the bottom box. You must enter a whole number, between 1 and 32,767.

The Visual Basic source code is:
Option Explicit

Private Sub cmdGo_Click()

On Error GoTo errhandler
If txtInput.Text > 32767 Then
MsgBox "Enter a positive, whole number between 1 and 32,767", vbOKOnly, "Input Error"
ElseIf txtInput.Text < 1 Then
MsgBox "Enter a positive, whole number between 1 and 32,767", vbOKOnly, "Input Error"
End If

Dim i As Integer

i = txtInput.Text
Randomize
txtOutput.Text = Fix(i * Rnd) + 1

Exit Sub

errhandler:
If Err.Number = 11 Or Err.Number = 13 Then
MsgBox "Enter a positive, whole number between 1 and 32,767", vbOKOnly, "Input Error"
End If
Exit Sub


End Sub

Click here to download the free random number generator