Asked • 04/24/19

How to use Randomize to choose from array list?

I am trying to randomly generate, based off of the 3 array list, 3 different positions the picturebox (stickimage) will appear. My code so far: Private Sub GenerateObjects() Dim RandomClass As New Random() 'Generate random number Dim Y As Integer 'Y axis Dim ObstaclePos(3) As Integer 'Position where obstacle is allocated ObstaclePos(1) = 404 ObstaclePos(2) = 310 ObstaclePos(3) = 290 Me.stickImage.Left -= 20 If stickImage.Bounds.IntersectsWith(LeftStickBrake.Bounds) Then For pos = 1 To 3 Y = 'This is where I am stuck stickImage.Location = New Point(1014, Y) Next pos End If End Sub

1 Expert Answer

By:

Patrick B. answered • 05/03/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.