Tempo07 de Febrero del 2004
PreguntaTengo un array de 5 posiciones. Y en esas cinco posiciones quiero meter aleatoriamente un numero del 1 al 4 cada segundo con un timer.
Mi problema es que con este codigo adjunto sólo me llena la posicion 0 dl array!! Q HAGO????
Private Sub timer_Timer()
Dim mas_peke As Integer
Dim mas_grande As Integer
Dim i As Integer
Dim anums(5)
mas_grande = 4
mas_peke = 0
timer.Enabled = True
For i = 0 To UBound(anums)
'while i < mas_grande si hago esto me salen los 5 de golpe y kiero cada segundo uno!!
timer.Enabled = True
Randomize
anums(i) = Int((mas_grande - mas_peke) * Rnd + mas_peke)
Print (i); (anums(i))
'i = i + 1
Next i
End Sub
Mi problema es que con este codigo adjunto sólo me llena la posicion 0 dl array!! Q HAGO????
Private Sub timer_Timer()
Dim mas_peke As Integer
Dim mas_grande As Integer
Dim i As Integer
Dim anums(5)
mas_grande = 4
mas_peke = 0
timer.Enabled = True
For i = 0 To UBound(anums)
'while i < mas_grande si hago esto me salen los 5 de golpe y kiero cada segundo uno!!
timer.Enabled = True
Randomize
anums(i) = Int((mas_grande - mas_peke) * Rnd + mas_peke)
Print (i); (anums(i))
'i = i + 1
Next i
End Sub
