Sunday, October 11, 2009

random?

yo, its about vb.

teach how to generate a random number


Private Sub Form_Activate()
Dim x, high, low As Integer

'high is the highest limit and low the lowest limit.

high = 999
low = 100

Randomize 'to generate random value each time

x = Int(low+(high-low+1)*Rnd)

Print x
End sub

thats bout it.
the formula its actually a math's formula to make sure the number generated is within the range u want.
The important part is the "Randomize" and "*Rnd"

People like kill_me or c.k yeo will understand in jz a few seconds.
i dunno bout blique though.

bt tell you what..
its nt so random after all..
u will notice when u run it a few times.
kk
bb
back to work..

No comments: