Random numbers but exclude some of them.

How can generate random number from, lets say 220 to 620 but exclude from 395 to 445.

I want some actors to be spawn randomly but if they colide to each other to move -75 or +75 pixels on x and y axis from its original position.

Comments

  • darrelfdarrelf Member Posts: 243
    Could you put the exact list of numbers into a table and work off that?
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited October 2013
    I would go with the table approach too.

    This may work for a range between 100 and 400 excluding numbers between 201 and 299 but I can't find a suitable pattern/formula for your numbers:

    random(100, 200) + (random(0, 1) * 200)
  • MantoManto Member Posts: 796
    edited October 2013
    Random number = 220+random(0,1)*226+random(0,174)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited October 2013

    ....or:

    Change Attribute RandA to random(1,2)

    Rule: When RandA =1
    Change Attribute MyNum to random(220,394)
    Otherwise
    Change Attribute MyNum to random(446,620)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • kaisarvrettoskaisarvrettos Member Posts: 4
    Thanks for your answers, I decided to go with the table solution. Its looks less complicated it will work for sure.
Sign In or Register to comment.