Skip to main content

Hi Guys,

 

Can anybody help me with this.

 

In condition statement i putted if a like b value is @int@rand()*4 which gave me random value 0,1,2,3.

 

Now in else i want to put rand value 6, 7,8

 

How can i do this ??

 

It would be a great help

 

Thank you 😊

The @rand() function generates a random number between 0 and 1, so 

@int(@rand()*4)
  • generates a random number between 0 and 1
  • multiplies that by 4
  • creates an integer (value without decimals) out of it.

Note the brackets there by the way, the function you posted results in <null> values.

 

In order to get a random value of 6-7-8 you could do

(@int(@rand()*3))+6

Alternatively, a RandomNumberGenerator will let you set upper and lower bounds for the random numbers


Reply