How to build a random generator without repetition

marjan's icon

Hi there,

I want to build a random generator that does not have any repetition which I know I can use [urn] or [urn-jb] objects but my problem is, if I use these objects and set the random range as 5 for example, it is easy to predict the fourth and fifth random numbers because 3 numbers have been taken out.

So I want to have each number to be produced two times and there is not any repetition, but besides, it's not that easy to predict the left ones. Though I know there is no way to avoid prediction in this way but when the range is bigger the prediction will become harder.

I am attaching a patch that I could manage to build so far but unfortunately I still couldn't get rid of repetition.

Max Patch
Copy patch and select New From Clipboard in Max.
<pre><code></code></pre>


random-generator.maxpat
Max Patch
mzed's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I've used this approach in the past:

Each number is "random", but no direct repetitions.