indigo icon indicating copy to clipboard operation
indigo copied to clipboard

`rollRange` under certain circumstances very likely to return the same result

Open felher opened this issue 7 months ago • 0 comments

The default java.util.Random handles calls to nextInt(x) where x is a power of two specially.

In Indigo, this leads to the fact that when you do dice.rollRange(1, 4) at the start of every FrameTick, you are overwhelmingly likely to get the same number as before.

Possible workaround: call rollRange(1, 4) (or with any other number) and discard the first return value. Successive calls seem to yield more random values.

felher avatar Jul 13 '24 18:07 felher