Tema: randomize
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/04/2006, 10:14
Cony28
 
Fecha de Ingreso: abril-2005
Mensajes: 73
Antigüedad: 20 años, 1 mes
Puntos: 0
Randomize

El formato es el siguiente;

Int((b - a + 1) * Rnd + a)
donde b es el limite superir y a el limite inferior, por ejemplo te queda asi

Dim n As Integer ' defines las variables
Dim i As Integer
Dim a As Integer
Dim b As Integer

Private Sub Command1_Click()
a = Val(Text1.Text)'ingresas limite inf
b = Val(Text2.Text)'ingresas limite sup
For i = 1 To n ' Cantidad de numeros al azar al mostrar
Text3.SelStart = Len(Text3)' los imprimes en text3
Text3.SelText = Int((b - a + 1) * Rnd + a) & vbCrLf
Next
End Sub

Private Sub Form_Load()
n = InputBox("Cuantos numeros al azar")' ingresas el total de numeros
End Sub