random number

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have a labelbox named label1. I want to put a random number in this box
between 4 and 144 inclusive.

Another label box named label2. I want to put a random number in this box
between 2 and 12 inclusive.

I am new to vb.net I am trying to teach myself. Thanks for any help.
 
Steve said:
I have a labelbox named label1. I want to put a random number in this box
between 4 and 144 inclusive.

The documentation for 'Random.Next' contains a sample for getting a
pseudo-random number.
 
Dim x as new Random
x.next(4,145)

Note the 145 in the code above. While the number you specify for your lower
bound may be generated, the number you specify for your upper bound will
not...only numbers up to but not including the upper bound.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top