A varying number of lists are stored in a coll object. Then a series of bangs is provided to a random integer generator. With each bang the generated integer will decide which list will go out of the coll. Obviously, this number must be between 1 and the varying length of the coll. This means that the RND generator has to take into account any changed length of the coll before generating the integer. So, I guess we have a circuit like the following:
- A loadbang-ed message ‘length’ must enter the coll object to make it output its length.
- This length number must get into the right inlet of a ‘between’ (RND gen.) object to set its maximum.
- A bang in the left input of the ‘between’ object will generate a random integer.
- The integer will go back into the coll and make it output the corresponding stored list.
- The output list will be sent to an iteration mechanism that will read and output its atoms one by one.
- When the last atom of the current list is output, a new bang will be sent to the ‘between’ object so that a new list will be picked and the process will be repeated (stages #3 – 6).
The problem with the above process is that it stumbles on the functionality of the coll object: a coll outputs both its length and any stored data from the same outlet (why, I wonder?), but in processes like the above, the length of the coll must be output only once (in the beginning of the session) and it should only feed the ‘between’ object (it should never reach the iteration mechanism, since it is irrelevant). Therefore the routes of the coll's length and its data must be different, although they are all integers and they are all coming out of the same outlet.
Any ideas please?