We can distribute the total number of users in a script randomly, e.g if there are more than one Action in a script and we want to execute it randomly, we can use the below syntax:
===================================================================
int generateRandomTPS; //declaring the variable name
generateRandomTPS = rand() % 99; //Random number between 0 and 100
//This is check if the randomly generated number is between 0 to 49 then run Action1.
if ((generateRandomTPS >= 0) && (generateRandomTPS <=49))
{
Action1();
}
//This is check if the randomly generated number is between 50 to 100 then run Action2.
else if ((generateRandomTPS >= 50) && (generateRandomTPS <=100))
{
Action2();
}
Note: It's advisable to create a new action in which you can write the above code.
===================================================================
int generateRandomTPS; //declaring the variable name
generateRandomTPS = rand() % 99; //Random number between 0 and 100
//This is check if the randomly generated number is between 0 to 49 then run Action1.
if ((generateRandomTPS >= 0) && (generateRandomTPS <=49))
{
Action1();
}
//This is check if the randomly generated number is between 50 to 100 then run Action2.
else if ((generateRandomTPS >= 50) && (generateRandomTPS <=100))
{
Action2();
}
Note: It's advisable to create a new action in which you can write the above code.
Comments
Post a Comment