Random Number between 1 and 100

thespis721thespis721 Member Posts: 4
edited November -1 in Working with GS (Mac)
Thanks for all the help I'm getting on this board. I think I have an easy question but I it's alluding me.

What's the formula for the game to pick a random number between 1 and 100?

Like I click a button and the game chooses a number between 1 and 100 at random?

Thanks again!

Comments

  • JeffreyShimaneJeffreyShimane Member Posts: 372
    You need to use the random expression:

    random(min,max)

    Replace the min with 1 and the max with 100:

    random(1,100)

    This will generate a random number between 1 and 100. This expression can be used wherever a number can be used. For example, you can have an actor rotate to a random angle using Rotate to Angle and using random(0,359) for the direction. Or you can create a game attribute and use Change Attribute within a timer to set it to a random number over and over.

    - Jeff
  • thespis721thespis721 Member Posts: 4
    Thanks so much. So simple, so easy. Sometimes the most obvious answers are right in front of your face.
Sign In or Register to comment.