How to get random different numbers in range

You could fill an array of N size with numbers 1 through N, perform a shuffle on that array, then grab the first X elements.

I’m having a little of a hard time finding the logic behind my problem, let’s say i have a range that goes from 1 to N, how could i in blueprint pick a random quantity of integer numbers between 1 and N which are all different?
Basically I need:

Pick a random quantity (1 <= Q <= N ) of random integer numbers ( 1 <= X <= N ) without X being repeated, all in blueprints.

Allar’s suggestion is excellent for smaller ranges. That is how I would go about it for small values of N. For a larger N you might not want to create an array and shuffle the entire thing (say N is 100,000 or 1,000,000). Instead, if you need a large range, I would create a loop to add the random values to an array using the Add Unique node. That should prevent duplicates from showing up.

Thanks, that suited my needs.

Aye, this is definitely a better way to go for large values. I tend to not recommend this though because people sometimes create a bad source of random numbers and end up in occasional infinite loops. On the other hand, the above solution can be sped up in large cases by allocating space in the array ahead of time with a Resize node. I think the best possible solution would be to steal from cryptographic algorithims and use a seedable one way modulus generator as those functions are guaranteed to result in a unique and even distribution within a finite range

How exactly would this look in blueprint? The ‘shuffle’ node does only have an exec output and the ‘GET’ node an item node. How would I get an item after it has shuffled?

Create a macro library