Azar.vb

  1. Public Class Azar
  2. Private Shared random As New Random()
  3.  
  4. Public Shared Function Entre(ByVal inferior As Integer, ByVal superior As Integer) As Integer
  5. Return random.Next(inferior, superior + 1)
  6. End Function
  7.  
  8. Public Shared Function Digitos(ByVal total As Integer) As String
  9. Return Simbolos(total, "0123456789")
  10. End Function
  11.  
  12. Public Shared Function Simbolos(ByVal total As Integer, ByVal caracteres As String) As String
  13. Dim vector() As Char = New Char(total - 1) {}
  14. For i = 0 To vector.Length - 1
  15. vector(i) = caracteres(random.Next(caracteres.Length))
  16. Next
  17. Return New String(vector)
  18. End Function
  19.  
  20. Public Shared Function ElementoArray(ByVal array As Object()) As String
  21. Return array(Entre(0, array.Count - 1)).ToString()
  22. End Function
  23.  
  24. End Class
  25.  
  26.  
  27.  

Proinf.net