Is it possible via shader nodes only to generate a list of random numbers that don’t appear twice? Say numbers 1-28 just reorganized in a random way instead of i.e. 12 and 19 appearing twice or thrice?

I’d like to do a random UDIM lookup for a big video wall (9x2) consisting of only PIP sources. I can generate random lookup, but finding a seed value that don’t generate duplicates takes forever. I can set it up more manually of course, but would be nice to have this approach. Without arrays, I’m kinda lost.

You arent after truely ‘random’, you are after randomly sorted list.

The issue is that there isnt a node for this in cycles.

The work around? On all your objects you want the ‘randomly sorted list’ to occur on, add a custom attribute. write a python script to assign the randomly sorted numbers to each object. then use that to drive the UDIM lookup.

This is all in a single object, separate meshes, and the display surface UV is continuous. Although I could work with a separate UV channel as well for indexing purposes I guess.

Would it be possible to use a geometry node repeat zone to create a randomly sorted list and assign unique per “UV collapsed island” or something, and fetch that value using attribute node in shader? Just trying to think out loud, but I’d rather avoid scripting.

Maybe position of the collapsed UV, snapped, through white noise, check if number has been used before and redo with other seed if so, then store the random number as an attribute to the UV coordinate?

What I have is this; 9x2 separate rectangles in a mesh (with this material, there’s more to the mesh itself), I want a random number (integer best?) between say 0 and 23 (24 UDIM tiles total, 6 more than I need) associated with each face. Somehow. In terms of 9x2 image lookup, result could look like this:
23, 12, 03, 00, 07, 18, 09, 10, 21
13, 11, 06, 22, 04, 14, 15, 01, 05
Unused: 02, 08, 16, 17, 19, 20

Note that UDIM tiles aren’t UDIM tiles in the traditional sense, I’m just exploiting that numbering system to lookup a set of relevant pictures received from client to put onto the displays.

It’s not super important, so don’t go out of your way unless I’m missing an easy approach. Never had a complaint for same picture showing up more than once. It just triggers my OCD

Create a list of points and capture their original index. After that, sort the points by a random value. At last, sample the original index from the randomly sorted points.

Well… Random numbers never go along OCD very well…

And I thought about this problem a bit and there’s no easy answer to do it alone as a shader. (in fact there’s no answer at all, it’s simply impossible!)
if the amount of keys (locations, uvs, etc) are bigger than the set, the mapping will always have the possibility of repeated values.

So you need to use some pre-calculation before the data is sent to the renderer.
All you can do is to use python, or GN (just like @Zebrahead suggested) to stored some value in the object/element.

One of my favorite bits of useless annoying pedantry is that a random set without repetition is not random at all, followed closely by the fact that humans are just about the worst randomness generators possible, due to our brains’ strong pattern-finding instincts and a primal refusal to see randomness as anything other than “non-patterned”. No one would ever give 1111 as a random four digit number, yet it’s every bit as random as 9352 or 8882 or 9003 or anything else

The first number comes out 1, there is a 50% probability that this is the case.

When you generate the second number there is also a 50% probability that the number is 1.

But if you consider both generations together there are 4 possible outcomes.

11 12 22 21

The probability both numbers being the same is still 50% (1 in 2) but the probability of both numbers being 1 is 25% (1 in 4)

That is why very few people like to buy a lottery number that is 1111 (even if other combinations have the same overall probability).

The problem is that if we forget the numbers altogether all combinations have the same probability, repetition can always occur but ”none patterned” is more probable and the more numbers added the less probable a specific pattern.