So after some experimentation I found out that the ‘Random Integer’ node is not so random. It is pretty predictable.
I’ve put everything inside a spreadsheet and I’m still adding results. For now, I have a test with 3 Material Instances put into an Array. There is a random int. node connected to set a cube’s material to Red, Green or Blue. To make sure that it is operating normal, the cube Spawn SceneComponent gets removed on CubeSpawn.
The fixed val. for the amount of cubes is 442 for 1 chunk. There are 18 chunks. That means that 7956 cubes need to spawn. If everything spawn correct there should be 8000 Actors in the Scene (including the gamemode etc, and the Minimal_Default stuff!).
I also noticed some Cubes not spawning, EVEN if they have to ignore collisions.
Multiple calls to he Random Integer node is guaranteed to give you a different sequence of random numbers between 0 and max. These random numbers are generated using the c++ STL rand() function which uses srand() for its seed generation. Unreal uses the OS current time to generate this seed and it will always be different, hence, you are very unlikely to get the same sequence of random integers! You can verify that these seeds are different for every session of Unreal Engine by going to the Output log, scroll all the way up and in the first few lines you should see this message LogInit: Display: RandInit(-1728523613) SRandInit(-1728523613). Verify that your seed is different than mine!
These random numbers are uniformly generated so after many calls to Random Integer node, you should have approximately the same quantity of each random number.
If you need the same sequence of random numbers, then you must use Random Streams.
If your cubes don’t spawn the way you want them to, then it is very unlikely to have anything to do with Random Integer node and most likely is caused by the logic you’ve implemented or the functions you’ve used. If you need help with spawn actor function, then please post it as a separate question with pictures of your blueprints so that we can help you address it.