Imports System
Imports System.Collections.Generic
Class Program
Private Shared Function GenerateRandomNumbers(ByVal count As Integer, ByVal lower As Double, ByVal upper As Double) As List(Of Double)
Dim rand = New Random()
Dim numbers = New List(Of Double)()
For i As Integer = 0 To count - 1
Dim num As Double = lower + (upper - lower) * rand.NextDouble()
numbers.Add(num)
Next
Return numbers
End Function
Public Shared Sub Main()
Dim count As Integer = 10
Dim lower As Double = 0.0, upper As Double = 3.0
Dim randomNumbers As List(Of Double) = GenerateRandomNumbers(count, lower, upper)
For Each num As Double In randomNumbers
Console.Write($"{num} ")
Next
End Sub
End Class
' run:
'
' 0.7579872104993879 1.3493998745057838 1.1880105496121973 2.532650445663669 2.3058954033929995 2.564016672496782 1.1946619969456007 2.7537411221671686 2.7272529938960983 1.8784676849876054
'