Funzione random

martedì 08 settembre 2009 - 12.42

memmo77 Profilo | Expert

Devo generare un numero random con decimali. Come faccio? Grazie

samar Profilo | Senior Member

Provato con:

Dim RandomNumber As Double
RandomNumber = RandomClass.NextDouble()

memmo77 Profilo | Expert

Scusami non ho specificato, errore mio. Io ho ad esempio due numeri

10,2457889
15,248777

devo fare un random tra questi due. Grazie

samar Profilo | Senior Member

Dim RandomClass As New Random()
Dim RandomNumber As Double = 15.248777 - 10.2457889
RandomNumber = RandomClass.NextDouble() * RandomNumber
RandomNumber += 10.2457889
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5