Random numbers without specific numbers ?

Hi ..

How can i random between 8 values , then i want to random between 7 values ( without first value ) , then i want to random between 6 values ( without first and second value ) ..

Example :

1-random(1,8) => the number is (3)
2-random(1,8) => accept all numbers except (3) , like (6)
3-random(1,8) => accept all numbers except (3) and (6)

and like this ..

i hope you understand what i mean ..

Sorry For my Language ..

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2013
    Put the possible values in a table with one in each row.
    1
    2
    3
    4
    5
    6
    7
    8

    Choose a random row and then delete it:

    Change attribute game.randomRow (integer) to random(1,tableRowCount(tableName)).
    Delete Row at index game.randomRow

    Edit: then Change attribute game.randomNum (integer) to tableCellValue(tableName,game.randomRow,1)

    Each time you repeat those three behaviors, it will choose a random number and then remove it from the set of choices.

    If you need a loop, see http://forums.gamesalad.com/discussion/comment/381275/#Comment_381275 (the first post and entire thread are also pretty interesting if you have the time). Then for each iteration of the loop, run those three behaviors.
  • adlaimadlaim Member Posts: 68
    edited December 2013
    Hi @tatiang and thank's

    but that's not work , may be i made some thing wrong .

    but if you have time .. can you make a simple template for me ?

    thank's again ..
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Here you go!
  • adlaimadlaim Member Posts: 68
    @tatiang Thank Youuuuuuuuuuuuu ..
Sign In or Register to comment.