Reputation:
I have this code
label1.Caption:= 'Number is:' + inttostr(random(2) + 1);
but in result I have "1" every time. Can you explain what I did wrong?
Upvotes: 0
Views: 122
Reputation: 136391
To initialize the random number generator you must call Randomize method before to use the random function.
Randomize
Upvotes: 6