Non-Repeating Random Numbers - CodeAlpaca

Hello, CodeAlpaca here!

Once again back at it with another example. Just like my previous example, got this one off of Discord. Someone was trying to make a non-repeating random number generator, but it seemed like they were going about it in the wrong way so I figured I’d see if my instincts were right.

Once again, this is a pretty simple example that should have a decent number of practical uses. Managed to get this down to just 8 behaviors (excluding inputs/outputs)

image

If you gave it the range 4-9, it would output [4, 5, 6, 7, 8, 9] in some random order.
Normally the Random behavior could give you a repeat number, but this system gives you a new number each time (and once you have gotten all unique digits, “Fail” will output as 0).


The code is inside the “!Bundles” object. Galactian, PixelPizza, and Tapeboii also made some as well which you can view if you like in a separate bundle.

8 Likes

Bookmarked, not too sure when I’ll use it, but I know I will someday

4 Likes

Wow, this is epic. I’ll put it in my Example archive. This will help greatly.

3 Likes