Random/True Random

FreshlyMintedFreshlyMinted Member Posts: 14
edited November -1 in Working with GS (Mac)
So I'm trying to get random numbers but I'm having trouble. How do most people go about this. Is there a random seed change command? is there a way to set up a global game timer that you can mod?

Comments

  • PhoticsPhotics Member Posts: 4,172
    game.Time is the game timer.

    Using the modulo function, you might be able to create something more random... if the following formula is used at random intervals.

    floor(game.Time%2)

    That's mentioned in the math section of the Unofficial GameSalad Textbook. That's for a coin toss. It's in the part of the book where I explain how "Modulo" works. Even after knowing more about it, I still think it's a name for a comic book super villain.
  • PhoticsPhotics Member Posts: 4,172
    It can be modified to simulate the roll of a die...
    ceil((game.Time*1000)%6)

    But if you use it twice in a row...
    ceil((game.Time*1000)%6)
    ceil((game.Time*1000)%6)

    You get the same number twice.
Sign In or Register to comment.