forked from InfiniTimeOrg/InfiniTime
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use <random> library for RNG in Dice and include motion controller in…
… seed there are known problems with rand() and srand() (see https://en.cppreference.com/w/cpp/numeric/random/rand) and the <random> library is preferred for this reason. the function used from <random> also avoids a very rare bias that would occur using rand() and modulo, when RAND_MAX is not a multiple of d and the initially generated number falls in the last "short" segment. this commit also updates the seed to derive entropy (via seed_seq) from a mix of the system tick count and the x,y,z components of the pinetime motion controller-- taking inspiration from and with credit to @w4tsn (InfiniTimeOrg#1199)
- Loading branch information
Showing
3 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters