Home > Software engineering >  VB6 RND function in the formula how to understand
VB6 RND function in the formula how to understand

Time:10-13

Solving!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

CodePudding user response:

Is mainly used to generate the random number
In order to generate a random integer, within the scope of using the following formula:

Int (Rnd (upperbound lowerbound + 1) * + lowerbound)

Here, the range of random number is a limit to upperbound, whereas lowerbound is the lower limit of the random number range,

Note if you would be repeated random number sequence, before using a numerical parameter Randomize direct call Rnd has negative parameter values, use the same number value of Randomize will not be repeated sequence of random Numbers,
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Rnd function example
This example USES the Rnd function randomly generates a random integer from 1 to 6,

Dim MyValue
MyValue=https://bbs.csdn.net/topics/Int (Rnd (6 *) + 1) 'to generate a random value between 1 to 6,
  • Related