Module Module1 Sub Main() makeArray(10,0,10) Do Until (Console.ReadKey.Key = ConsoleKey.Escape) Loop End Sub Public Function randomNum(ByVal high As Integer, ByVal low As Integer) As Integer Dim randomValue As Integer randomValue = CInt(Math.Floor((high - low + 1) * Rnd())) + low return randomValue End Function Public Function checkExist(ByVal numbers() As Integer,ByVal searchval As Integer,ByVal size As Integer ) As Integer For value As Integer =0 To size If searchval = numbers(value) Then ' Console.WriteLine("found") Return 3 End If Next Return 4 End Function public Function makeArray(ByVal high As Integer, ByVal low As Integer, ByVal size as Integer) as String() Dim count as Integer Dim random As Integer Dim arra As New ArrayList() Dim dif = size-1 ' Dim arra As Integer() = New Integer(19) {} 'Dim arra(20) As Integer For index As Integer = 0 To size+9 random =(randomNum(10,0)) if Not (arra.Contains(random)) Then count = count +1 'Console.writeline("Already contains generating new number") random = randomNum(10,0) while (arra.Contains(random) = true) random = randomNum(10,0) End While End If If arra.Contains(random) = false arra.add(random) End If Next 'Console.WriteLine(count) For Each item As String In arra Console.WriteLine(item) Next End Function End Module
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)