if random number between is not any number between

readerboy7

  • Posts: 59
i want to make a behavior where if a random number is not any number between 2 other numbers, something happens. can you please help?

Ganu

  • Posts: 224
always
{
generate random number (your_number);
      if (your_number < higher bound, and your number > lower bound)
      {
     
      }
}
Currently waiting for joints in stencylworks.

Hectate

  • *
  • Posts: 4643
That would check to see if your number was within the higher and lower bounds. What he wants is to make sure that the random number is not between those bounds. You should be able to swap the greater/less than signs and switch the AND to an OR instead.

Code: [Select]
if ( yourNumber > higherBoundary OR yourNumber < lowerBoundary )
{
 doWhateverYouNeedTo;
}

« Last Edit: September 24, 2011, 06:32:47 am by Hectate »
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Ganu

  • Posts: 224
Oww sorry my fault.
Currently waiting for joints in stencylworks.