Randomly selecting a cell in matrixctrl--a more efficient way to do this?
I'm fairly new to Max but I sense there is a much better and less time consuming way to do what I did here. Poking through the reference material, I couldn't quite figure it out. I built this subpatch to randomly turn on the cells in an 8x8 matrixctrl object when triggered by a button object (it's for a randomized painting I'm doing). Is there a more efficient and less tedious method to replicate this?

My next steps are to figure out how to make it so it doesn't repeat, and then light up a launchpad midi controller to make it more interactive.
Any help or insight is greatly appreciated!

(i wonder if picture comments are enough to count as post content? - no, they are not.)
urn 64 has no problem to avoid repetitions.
At least not to set any cell to 1.

Another thing is in case you want to start setting matrix which allready has
set cells.
then you need list of set cells, and filter
yep, that´s what everybody thinks about urn, that´s why i mentioned it. :)
...try before you buy!

Excellent, thank you kindly. I appreciate you taking the time!
urn does exactly what it should,
output non repetitive numbers till it exhausts it's range.
if by chance last number in the cycle and first after reset happen to be the same,
which would well possibly happen if you use urn with small range
then it is easy to insert something to fix it
pseudo vanilla?

...which means that it does not fix repetitions.
where random has averagely 1:n repetitions, urn has 1²/2 repetitions appearing at predictable positions.
furthermore urn does not even do the same as random, because it doe not allow repetitions across its whole range, where random can easily gives you 3 4 3 4 3 4 3 4 if it is in a mood.
both can be interesting, so it is probably a good idea to implement both in his app.
and of course allow to use different modes and ranges for the two axis. which i why i made the repetition check around the result and not behind the random. :)
Sorry, but something doesn't add up, I tried urn and the sequence of numbers doesn't repeat in my case.

Checked until the 100 digits, sometimes happens that the sequence is the same, or the first of a new cycle is the same of the last of previous, but I don't see any repetitions within a cycle.
for original task - fill 8x8 matrix using (of course) non repeating
random addresses, urn seemed to be easiest soution,
because it does not repeat, and it stops once matrix is full.
using any other random generator will complicate the flow
because on would need to monitor matrix state, and count number of set cells.
Repetition here is not only comparison to last entry,
but to all allready created numbers.
At least that is what I understood from the question.
maybe blind shots (repetitions) are acceptable in this context ?
it is easy to simulate non repeating urn mode using random
