how to create a rule that returns a random number between two numbers???

1UpGamestudio1UpGamestudio Member Posts: 213
edited November -1 in Working with GS (Mac)
Good evening to all,
Does anyone know how to create a rule that returns a random number between two numbers does not close?
example between 3 and 8 not counting 4-5-6-7

Comments

  • A3MGA3MG Member Posts: 152
    Wait, what?

    Do you want the rule to randomly pick either 3 or pick 8?
  • bluebyu25bluebyu25 Member Posts: 500
    Yes he just wants two number values chosen at random.

    At least that's how I took his question. I was going to answer it as I'm familiar with random, but I don't know how to achieve what he is going for.
  • CaptFinnCaptFinn Member Posts: 1,828
    Maybe he should be lil more specific. Do you mean any 2 numbers between 1-9 and 0. Because 12 and 23 are 2 seperate numbers. Or are you meaning 2 Digits. Like rolling Dice. Or do you mean like flipping a coing. Heads 1 Tails 2 or Heads 4 Tails 7. Always a 4 or a 7?
  • bluebyu25bluebyu25 Member Posts: 500
    Heads and tails I'm pretty sure is what he means. But hey I'm not him so who knows lol. Don't really see the application for two random numbers as you could do something to that effect much easier a different way.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Make a interger attribute call it randomnumber. That will be the random number generated, it will be stored in that attribute

    whenever you want the random number to be generated, have a change attribute behavior changing randomnumber to random(1,8)

    Youll have to go threw the expression drop down and pick random, then replace min and max with the lowest possible number, and the highest possible number you want.

    Cheers
  • CaptFinnCaptFinn Member Posts: 1,828
    John will that stop 2-3-4-5-6-7 from being chosen? I think he wants the random generator to ignore all digits but the 2 he wants. He used 3 and 8 as a example?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    ahh i see didnt notice that.

    IF you wanted to pick between say 3 and only 8 this is a easy way to do it it.

    you could set it up the same as above except have a extra attibute called generated number

    then have a rule when attribute randomnumber is equal to or less then 4, change attribute generated number to 3

    then have another rule when attribute random number greater then 4, change atibute generated number to 8

    that will only pick betwwen those 2 numbers depending on the random number made

    cheers
  • CaptFinnCaptFinn Member Posts: 1,828
    I think he is going to have to get with you privately so he can explain what he is actually wanting to do. Probably doesnt want to spill his idea on here.

    He could be thinking about a missle doing 3 damage sometimes 8 damage. he could be talking about something like rolling of the dice. Like in a DND style game. He could be talking about a image int he background that a simple animation could fix.
  • sparkzillasparkzilla Member Posts: 152
    If he wanted either 3 or 6 he could do random(1,2)*3

    __________________

    Coming Soon!: Sweepr
  • CaptFinnCaptFinn Member Posts: 1,828
    That might make his choice in 2 digits limited. haha
  • RHRH Member Posts: 1,079
    just do something like random(1,2)

    when X=1 change attribute A=3
    when X=2 change attribute A=8
  • calvin9403calvin9403 Member Posts: 3,186
    ya he has to say it clear

    Calvin
  • GLGAMESGLGAMES SingaporeMember Posts: 988
    RH has the correct concept.
  • calvin9403calvin9403 Member Posts: 3,186
    ya that is a easy way
  • bluebyu25bluebyu25 Member Posts: 500
    I think the only way to do this is if Charlie Sheen programs it. Winning.
Sign In or Register to comment.