If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Undefined offset problem

What I my script needs to do is select the first data element from all the sets of data, then select the second data element from all the sets and then the third and so on. If there is no third element then the script needs to select the first element of that set again and then continue with the second in that set ( but continuing as normal with all other sets ).

So each set continues outputting sequentially and on ending returns to beginning until the desired number of groups are created..

How I did something similar in the past was, using the data like clock pieces. You rotate the last point until it reaches its limit, then you rotate the point before it etc etc until finally you've rotated the initial point to the limit, resulting in all possible combinations being used.

While technically each group generated by this script is unique
because one element is different, the resulting groups are in fact
all extremely similar.

( this is even more pronouced with larger data sets of course)

The previous run produced a much better "shuffled" pack of data groups

That was because ALL of the row elements changed.

In fact it was great ! -
except for where the number of elements in the sets was the same.

The only thing we needed to change was to stagger - or somehow change -
the looping of those sets with the same quantity of elements.

Actually this will result in a much lower number of possible combinations
than this new script - but the resulting data groups will be much more diverse.

( I know it is my fault - this statement "The idea is to systematically use
all the combinations and avoid duplicating the patterns." made it look like
I just wanted a technically unique groups, but what I really want is:as many
"dis-similar" groups as possible. The first script was nearly there !! )

Thank you VERY much again !

Is it possible to use something from the second script inside the first script to
effect the cycling of the sets that have the same number of elements ??

But I noticed that often the rand() would chose the same
element several times and omit selecting some of the elements altogether.

Just like rolling a die - you may get the same result several times in a row.
( and you could wait a long time to throw a six !!! )

( In theory if you throw the die 100 times you should get a six
about 17 times ... but in practice you could get it 40 times or zero )

So I was trying to come up with a systematic way of using all
the elements and produce a more even spread of the data.

In other words: a better result that the random generator does.

Maybe your use of the shuffle() function produces a better result ???

The other advantage of building a systematic "dis-similar" generator
is that it should be possible to calculate the number of combinations and
output that number of groups - rather arbitrarily picking a number like 100.

Does what I am saying make any sense ?

I think we ( well you !!) were nearly there with the first script.
Is it possible to modify that one to effect the looping of same-quantity
data sets ?

OK, this is the last idea that's currently come to mind.
This time I record the set lengths, and if there was a proceeding set with the same length I shift the data points X amount of times.
So the resulting data is still predictable.