table query - random not picked twice and position

Hi,

I am trying to work out how to do this.

I have 7 objects, lets say rects, each has a different width x.

for example: obj1 =50, obj2 = 55,obj3 =60,etc

What I want to achieve is to randomly choose all the objects only once and align them on the x axis one after another.

Now I have tried a few things but cant seem to get it down so I am asking for pointers please

Here’s a good thread on shuffling a table, which should work for your purposes:

https://forums.coronalabs.com/topic/50526-trying-to-implement-52-random-numbers-without-repeating/

Alex is right. You want to use a “shuffle” method. We even have a tutorial for it (in addition to that wonderful thread):

https://coronalabs.com/blog/2014/09/30/tutorial-how-to-shuffle-table-items/

Rob

Hi Chaps,

yes I read that while I was waiting for some replies.

I have it working, I neglected to think about shuffling the table first and then getting it from an already shuffled table.

Good links also

Just attempting to work out how to place them nect to other.

Thanks

Here’s a good thread on shuffling a table, which should work for your purposes:

https://forums.coronalabs.com/topic/50526-trying-to-implement-52-random-numbers-without-repeating/

Alex is right. You want to use a “shuffle” method. We even have a tutorial for it (in addition to that wonderful thread):

https://coronalabs.com/blog/2014/09/30/tutorial-how-to-shuffle-table-items/

Rob

Hi Chaps,

yes I read that while I was waiting for some replies.

I have it working, I neglected to think about shuffling the table first and then getting it from an already shuffled table.

Good links also

Just attempting to work out how to place them nect to other.

Thanks