Número aleatorio


/ Published in: VB.NET
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.