/ Published in: VB.NET
Retorna un decimal aleatorio entre un mÃnimo y un máximo.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Public Shared Function DecimalAleatorio(Optional ByVal maximo As Decimal = Decimal.MaxValue, Optional ByVal minimo As Decimal = Decimal.MinValue) As Decimal Dim r As New Random() If minimo > maximo Then Dim t As Decimal = minimo minimo = maximo maximo = t End If lastdecimalvalue = (r.NextDouble() * (maximo - minimo)) + minimo Return lastdecimalvalue