aboutsummaryrefslogtreecommitdiff
path: root/VB.Net Projects/MaxMin
diff options
context:
space:
mode:
authorKamen Mladenov <kamen.d.mladenov@protonmail.com>2021-02-23 12:50:16 +0200
committerGitHub <noreply@github.com>2021-02-23 12:50:16 +0200
commit7502b7f3aec5ef372c122eeafa55e88f6d3f14af (patch)
tree3ab942ef0e28c7ecd8360ac01bb3d2561ae7da69 /VB.Net Projects/MaxMin
parent02b87d0395f21b4355e2e2987aace5c3bf817c46 (diff)
downloadSchool-Projects-7502b7f3aec5ef372c122eeafa55e88f6d3f14af.tar
School-Projects-7502b7f3aec5ef372c122eeafa55e88f6d3f14af.tar.gz
School-Projects-7502b7f3aec5ef372c122eeafa55e88f6d3f14af.zip
Actual fix for MinMax project array length
Diffstat (limited to 'VB.Net Projects/MaxMin')
-rw-r--r--VB.Net Projects/MaxMin/MaxMin/Form1.vb4
1 files changed, 2 insertions, 2 deletions
diff --git a/VB.Net Projects/MaxMin/MaxMin/Form1.vb b/VB.Net Projects/MaxMin/MaxMin/Form1.vb
index dd92d54..f75c013 100644
--- a/VB.Net Projects/MaxMin/MaxMin/Form1.vb
+++ b/VB.Net Projects/MaxMin/MaxMin/Form1.vb
@@ -1,7 +1,7 @@
Public Class Form1
Const numberCount = 10, minimumPossible = 1, maxiumPossible = 100
- Dim numbers(numberCount) As Integer
+ Dim numbers(numberCount - 1) As Integer
Dim rng As Random = New Random
Private Sub btnNew_Click(sender As Object, e As EventArgs) Handles btnNew.Click, MyBase.Load
@@ -29,7 +29,7 @@
End Sub
Private Sub RefreshNumbers()
- For index = 1 To numberCount Step 1
+ For index = 0 To (numberCount - 1) Step 1
numbers(index) = rng.Next(minimumPossible, maxiumPossible + 1) ' Exclusive upper bound
index -= numbers.Count(Function(x) x = numbers(index)) - 1 ' numbers.Count(...) is always between 1 and 2
Next