Page 1 of 1

unique random hits from the list

Posted: Tue May 28, 2013 9:30 pm
by tester
My brain is offline. I need some solution, to pick multiple (fixed amount) random hits from an array, but unique hits (i.e. no repeating values). Would be nice to ignore array elements with value = "0".

And some way with no "loop" prim, because this one (or related to it; queue?) seems to cause unpredictable delays.

Re: unique random hits from the list

Posted: Tue May 28, 2013 10:22 pm
by philter5
to avoid the delay, you could use some kind of "pre-selection" for the next hit of arrays.
i am sure there is a way without using loop prim, but using this method,
you can maybe use the loop primitive without the delay. i´ll post a example later.
imagine like this: a after load primitive triggers the loop prim directly after loading - so the first bunch
of hits is allready available (without delay) when you need them. and every time you manually trigger the
loop prim, it will get the numbers from the array and keep them till the next trigger is received, but output
the previously selected numbers

Re: unique random hits from the list

Posted: Tue May 28, 2013 10:56 pm
by tester
I think I found a way, but my brain is still ofline.

Generally what I'd like to do is. Imagine XY matrix of leds (let say 7x12). User selects which leds are on, and which are off (for this purpose - lowest amount of leds-"on" is required). This defines "custom range" in which unique randomization is done. Within custom range - randomizer picks a fixed series of values, and sends them to new array. I think "array" primitive will do the job, because I saw you can delete values at selected index (so it would go like this: pick random index, send value, remove from source). Final array is distribited, and it's values are received individually then.

Some sort of like that. :-)

I'd like to add "tuned randomizer" to my project, to see whether it will help to harmonize some sonic results.

Re: unique random hits from the list

Posted: Tue May 28, 2013 11:32 pm
by RJHollins
It would be interesting to see how efficient manipulating data inside an array can be.

I remember seeing a matrix of selector LED's back in one of the forums.

Keep us posted as you develop the idea 8-)

Re: unique random hits from the list

Posted: Wed May 29, 2013 12:05 am
by tester
Well - right now I must figure out one thing. I have the matrix of leds. But I can turn leds on/off manually. Which means that I need an idea to the situation, when less than (fixed) N leds are on. Should there be partial array duplication, or auto led switching to fit the amount, or "empty" array should be added - I don't know yet.

Right now, my unique randomizer looks like this. Input array represents matrix of leds (XYY).

Re: unique random hits from the list

Posted: Wed May 29, 2013 12:06 am
by MyCo
...

Re: unique random hits from the list

Posted: Wed May 29, 2013 12:12 am
by tester
Hey MyCo!

Could you add a filter on input, to remove "zero" values from the input list?

Re: unique random hits from the list

Posted: Wed May 29, 2013 12:16 am
by tester
Or - ideas how to improve that little fellow?

p.s.: not figured yet how to set the led list to fixed amount of items.

Re: unique random hits from the list

Posted: Wed May 29, 2013 12:44 am
by tester
I think the problem of "x<N" units solved itself. Octave sends value "0", which can be used for blocking randomization on non-used units. Acceptable solution. So now it's time to test it under load, because I'm not sure how these parsers, queues and loops will behave in real life conditions.