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.
 
Back
Top