By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,947 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,947 IT Pros & Developers. It's quick & easy.

random numbers help needed

P: n/a


Hi I am trying to create two random numbers

LBlnum1.Caption = Int(12 * Rnd) + 1
Lblnum2.Caption = Int(12 * Rnd) + 1

This creates the numbers but they are always the same numbers.
example I get 9 & 7 then 7 & 4 then 10 & 1

is their a way to make these numbers more random ?
Sparky
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> Hi I am trying to create two random numbers

LBlnum1.Caption = Int(12 * Rnd) + 1
Lblnum2.Caption = Int(12 * Rnd) + 1

This creates the numbers but they are always the same numbers.
example I get 9 & 7 then 7 & 4 then 10 & 1

is their a way to make these numbers more random ?


Execute the Randomize statement (only one time) somewhere inside your
program before using the Rnd function. The best place to execute the
Randomize function is in the Form_Load event (or Sub Main if you start
your programs that way).

Rick - MVP

Jul 17 '05 #2

P: n/a
Rick Rothstein wrote:
Hi I am trying to create two random numbers

LBlnum1.Caption = Int(12 * Rnd) + 1
Lblnum2.Caption = Int(12 * Rnd) + 1

This creates the numbers but they are always the same numbers.
example I get 9 & 7 then 7 & 4 then 10 & 1

is their a way to make these numbers more random ?


Execute the Randomize statement (only one time) somewhere inside your
program before using the Rnd function. The best place to execute the
Randomize function is in the Form_Load event (or Sub Main if you start
your programs that way).

Rick - MVP


Cheers worked great.....

Sparky
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.