Posted By

delm on 04/29/09


random integer aleatorio numero

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Número aleatorio

 / Published in: VB.NET

Retorna un número aleatorio entre un mínimo y un máximo

  1. Public Shared Function NumeroAleatorio(Optional ByVal maximo As Integer = Integer.MaxValue, Optional ByVal minimo As Integer = Integer.MinValue) As Integer
  2. Dim r As New Random(lastintegervalue)
  3. If minimo > maximo Then
  4. Dim t As Integer = minimo
  5. minimo = maximo
  6. maximo = t
  7. End If
  8. lastintegervalue = r.Next(minimo, maximo)
  9. Return lastintegervalue
  10. End Function

Report this snippet  

You need to login to post a comment.