VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Create a list of NON-REPETITIVE, randomly-generated numbers in any range! This time, you can custom

by terranRICH (Richard Brum) (2 Submissions)
Category: Math/Dates
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Thu 3rd October 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Create a list of NON-REPETITIVE, randomly-generated numbers in any range! This time, you can customize it!

Rate Create a list of NON-REPETITIVE, randomly-generated numbers in any range! This time, you can custom



    Dim MinVal As Integer, MaxVal As Integer
    MinVal = 1
    MaxVal = 20
    Dim Sequence(MinVal To MaxVal) As Integer
    For i = MinVal To MaxVal
redo:
        Sequence(i) = Int(Rnd * (MaxVal - MinVal + 1)) + MinVal
        If i > 1 Then
            For j = 1 To i - 1
                If Sequence(j) = Sequence(i) Then GoTo redo
            Next j
        End If
    Next i
    Text1.Text = ""
    For k = MinVal To MaxVal
        Text1.Text = Text1.Text & Sequence(k)
        If k < 20 Then Text1.Text = Text1.Text & ", "
    Next k
End Sub

Download this snippet    Add to My Saved Code

Create a list of NON-REPETITIVE, randomly-generated numbers in any range! This time, you can custom Comments

No comments have been posted about Create a list of NON-REPETITIVE, randomly-generated numbers in any range! This time, you can custom. Why not be the first to post a comment about Create a list of NON-REPETITIVE, randomly-generated numbers in any range! This time, you can custom.

Post your comment

Subject:
Message:
0/1000 characters