Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,885 questions

51,811 answers

573 users

How to generate random float in specific range with VB.NET

1 Answer

0 votes
Imports System

Public Class Program
	Public Shared Sub Main()
        Dim rand As Random = New Random()
        Dim min As Single = 2.0F, max As Single = 7.0F

        For i As Integer = 0 To 20 - 1
            Console.WriteLine(rand.NextDouble() * (max - min) + min)
        Next
    End Sub
End Class



' run:
'
' 6.03165958543851
' 6.7429674699637
' 2.08751751859091
' 3.277003435547
' 5.17701758266288
' 5.48372543160046
' 6.15223201231669
' 5.31501535294345
' 2.18057745191296
' 3.72142709918387
' 4.27792875248842
' 2.01655854751196
' 4.0273458734282
' 5.44214551543917
' 3.4244821860569
' 2.82564543272632
' 3.7116344495265
' 3.29087154580786
' 6.66446164048485
' 3.87443437142038
'

 



answered Jun 1, 2022 by avibootz

Related questions

...