Skip to content

srand(time(0)) called every time a BoidsSystem is created - Potential for Repeated Initialisation #1

@ColePoppleton

Description

@ColePoppleton

The srand(time(0)) call is located inside the BoidsSystem constructor. This means that if multiple BoidsSystem objects are created in quick succession, they might be seeded with the same time(0) value, leading to identical initial random states for the boids. This can result in less varied initial conditions. Move srand(time(0)) to a single, global initialization point, such as the main function or a static initialization block within the BoidsService namespace. This ensures it's only called once.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions