mercredi 6 janvier 2016

generating the same number

When i set up this bit of code, every time i debug the software it generates the same number. Can anyone tell me why this is happening?

dim value as integer
value = (CInt(Int(100 * Rnd())))
messagebox.show(value)

Because it should be random. here an example: (From top to bottom)

-

i debug the software

the code runs, and it generates the number 70

i stop the debugging

i debug it again and it generates the number 70 again

-

and that`s happening over and over, the first two times i thought it was just luck but when i did it a couple of times it always came back on the 70 (as an example). but when i keep the software running and i run the code over and over again by the use of a button, it generates completely diffrent, and random numbers. and then start it back up again and there is the number 70 again.

I hope someone could explain this to me, or have a solution

Greetings,

Wietse




Aucun commentaire:

Enregistrer un commentaire