Random without repeat

UltimateCreativesUltimateCreatives Member Posts: 27
edited August 2012 in Working with GS (Mac)
Hi. I thought it will be simple but ...

All i want to do is to pick for example 4 words from group of 10. All ten words are put in table. When I pick up first word and display it on the screen, everything it's ok. When I pick up second one it's also ok in case it's not the same word as first one. The same thing it with the third one and thourt.

I tried to do something like that.

I have made 4 attributes. Random1, Random2, Random3 and Random4. When I pick up first one from the table: random(1,tableRowCount(game.tablexxx )), I contrain attribute Random1 to number of row in table of the first word.

When I try do to the same with second word, I use the same rule, but I add the rule that if Attribute Random2 equals Random1 i repeat my random rule. The problem is, that sometimes it pick up the same number again.

It means that I have only two attempts to try to avoid picking up the same number. The problem is getting bigger when we do the same with number 3 and number 4.

What shoud be done? There should be made some kind of loop like random(1,tableRowCound(game,tablexxx)), until Random2 is not equal Random1. And then random(1,tableRowCound(game,tablexxx)), antul Random 3 id not equal Random 2 and not equal Random1 etc etc.

Any idea how to do it?

Kind regards

Comments

  • UltimateCreativesUltimateCreatives Member Posts: 27
    Making it's simple. Let's say that I have few words in table. For example green, blue, red, orange, purple, black, purple. Now I want to pick 3 of them without repeating. On top I want to aks "which colour is green" and want users to click the green one. But how to pick 3 different colours instead of green, red green for example? I would like not do delete rows form table.
  • UltimateCreativesUltimateCreatives Member Posts: 27
    OK i see that nobody could help me but it's no problem :-) I have managed to do it by myself. Greetings.
  • RD2012RD2012 Member, PRO Posts: 45
    HI, I'm having the same problem and was wondering if you would share the solution you found?
  • carlblanchetcarlblanchet Member Posts: 755
    @RD2012 Take a look at this video from tshirtbooth.


    Instead of putting position coordinates in the table, put whatever you have instead.
  • RD2012RD2012 Member, PRO Posts: 45
    Great, that's what was looking for. Thanks.
Sign In or Register to comment.