Current location - Education and Training Encyclopedia - University rankings - VB problem, programming problem, university VB wants to explain the sixth question in detail. How to do this problem in the end? What is the method? What knowledge points are examined?
VB problem, programming problem, university VB wants to explain the sixth question in detail. How to do this problem in the end? What is the method? What knowledge points are examined?
The knowledge point examined in this question is random number.

b-a=5

Because rnd is a random number less than 1 and greater than 0, (b-a)*rnd=5*rnd means that 5*rnd is greater than 0 and less than 5.

(b-a)*rnd+a=5*rnd+5 It can be seen that when 5*rnd+5 is greater than 5 and less than 10 int (rounded), then int( 5*rnd+5) is greater than 5 and less than or equal to 9.

Int((b-a)*rnd+a) is greater than 5 and less than or equal to 9, plus 1. The range of values is 6- 10, and they are all integers.