Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: use a ms granularity seed to avoid same random numbers #294

Merged
merged 4 commits into from Oct 17, 2022
Merged

Conversation

ianfhunter
Copy link
Owner

Description

Partially fixes: #292

Outstanding Issue:
It still uses rand() however, which is cryptographically insecure.

Considering PCG for longer term solution or Mersenne Twist

How Has This Been Tested

for x in 1 2 3 4 5
do
    ./build/dice d100
done

Before

52;
52;
52;
52;
52;

After

58;
26;
85;
14;
96;

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Test Coverage (Additional test(s) without any extra code)
  • Documentation Improvements
  • Code Quality / Maintenance

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation & I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I give my permission for my code to be used in this project under this license and any future license terms

Signed-off-by: Ian Hunter <ianfhunter@gmail.com>
Signed-off-by: Ian Hunter <ianfhunter@gmail.com>
@ianfhunter ianfhunter merged commit c8821ec into main Oct 17, 2022
@ianfhunter ianfhunter deleted the csprng branch October 17, 2022 11:07
@ianfhunter ianfhunter changed the title use a ms granularity seed Fix: use a ms granularity seed to avoid same random numbers Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Re-rolling in quick succession generates the same repeated result
1 participant