I am trying to create a stream of (pseudo) random locations. I am using the FRandomStream with a seed that is incremented every time a new object is spawned. When I spawn many objects a diagonal pattern starts to emerge (see image). This makes me believe that there is some constant relation between the first and second items retrieved from the RandomStream, even though a different seed is used every time. Can someone explain me why this happens and possible provide a workaround? Thanks!
The pattern:
Here some (simplified) code I use:
for (int32 i = 0; i < 100; i++)
{
// Create RandomStream
FRandomStream RandomStream;
// Set Random stream Seed to i
RandomStream.Initialize(i);
// Get 2 random floats
float randx = RandomStream.FRandRange(0.f, 100.f);
float randy = RandomStream.FRandRange(0.f, 100.f);
// Create a random spam locations based on the random floats
FVector RandomSpawnLocation = FVector::FVector(randx, randy, 0.f);
// Spawn the object
GetWorld()->SpawnActor<T>(RandomSpawnLocation);
}
Thank you for your time! :rolleyes: