Visual basic numer generators
Visual basic numer generators
hi!
i want to know how can i make vb choose between 1 or 2 randomly for a soccer simulator game that uses the goals engine like this:
private sub form_load()
timer1.enabled
end sub
private sub timer1()
lblg1tmp.caption= "1" or "2"
lblg1.caption or lblg2.caption= lblg1tmp.caption
end sub
i want to know how can i make vb choose between 1 or 2 randomly for a soccer simulator game that uses the goals engine like this:
private sub form_load()
timer1.enabled
end sub
private sub timer1()
lblg1tmp.caption= "1" or "2"
lblg1.caption or lblg2.caption= lblg1tmp.caption
end sub
Re:Visual basic numer generators
If I can understand your question correctly, then it should be like here:
random = int(rnd() * 2) + 1
select case random
case 1
lblg1.caption = lblg1tmp.caption
case 2
lblg2.caption = lblg1tmp.caption
end select
random = int(rnd() * 2) + 1
select case random
case 1
lblg1.caption = lblg1tmp.caption
case 2
lblg2.caption = lblg1tmp.caption
end select
Re:Visual basic numer generators
actually eero....that woulndt be exactly all that "random"
a better example would be this
intRandom is your Random integer
this is the most accurate randomizing format known to all man
a better example would be this
Code: Select all
'General Declarations
Dim intRandom as Integer
---------------------------
'Sub Procedure
Randomize
intRandom = int((Highnumber - Lownumber + 1)* Rnd)+ Lownumber
this is the most accurate randomizing format known to all man
Re:Visual basic numer generators
But the result is as random as code from my message...
Re:Visual basic numer generators
you for got randomize with is a vb constant which actually brings the Rnd to be random
Re:Visual basic numer generators
I know... I should've defined the integer too you know.
Re:Visual basic numer generators
Sorry Patrick, this is just a technicality, but Randomize is not a VB constant it's a method
Re:Visual basic numer generators
You should always care about what you code. I was just trying to help.