Random expression without repeating
Copy link to clipboard
Copied
I was looking for a solution to a problem. When I apply this expression
i = Math.round(random(1, 3)
It chooses a sequence of numbers with repetitions.. like...
1, 3, 2, 2, 2, 3, 1, 3, 3...
I'd like to know if there's a way to do the same thing without repeating numbers.
thanks!
Copy link to clipboard
Copied
Try this solution here - https://creativecow.net/forums/thread/how-to-make-random-generator-not-repeat-twice-the/
Copy link to clipboard
Copied
No need for complicated workarounds. Just increase the spread of the random range like e.g. from 1 to 300 and then scale the values with multiplications/ divisions or remap the ranges using linear(). Also random() accepts arrays, something which most people are completely ignorant of, so a simple random([1,2,3,2,3,1]) and so on can greatly improve distribution. In fact you could then even include a relatively trivial if()else{} check to prevent values on subsequent frames to be identical.
Mylenium

