Random int in range fails

When I randomly input the integer in range it usually does not spawn 1-3 tiles. When I manually input the number for it to spawn a tile, it always spawns every tile.


Above was with it random and below pics are with it Being manually input to a set number.


Random integer in range selects a random number every time you check against it. You aren’t spawning 1-3 tiles, you have a 33% chance to spawn a tile, three times. The result is 0-3 tiles. The average spawn would be 1.
Though that DoOnce node would prevent more than one from spawning anyways…

If you want better control, use random integer in range once, store the value in a variable, and then check against that instead.
This wouldn’t pick elements at random though, just a random number spawning. The easiest way to fix this would be to use the shuffle node to shuffle the array prior to the for loop.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.