Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perfect: Optimize random number generation by using static variables
Modified the `chooseRandom` function to declare `std::random_device` and `std::mt19937` as static variables. This change ensures that these objects are initialized only once, reducing the overhead of repeatedly creating them on each function call. This optimization is expected to improve performance by approximately 0.02%. This aligns with practices in ggevay's original Visual Basic code, where the random generator was a static (Shared) variable. Reference: ggevay/malom#3 (comment) Change-Id: Ic3b461caf52f533d4bbd5dc29ada65172d5c4450
- Loading branch information