Skip to content

Conversation

@TomTonic
Copy link
Owner

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a cryptographically secure pseudo-random number generator (CPRNG) to the rtcompare package, providing an alternative to the existing deterministic DPRNG for scenarios requiring cryptographic-strength randomness or unpredictable inputs.

Key changes:

  • New CPRNG implementation backed by crypto/rand with buffered reads for performance
  • Integration of CPRNG into bootstrap sampling (activated when seed=0)
  • Addition of F2T helper function for converting multiplicative speedup factors to threshold values
  • Documentation updates across README and inline comments

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
cprng.go Implements the new CPRNG type with buffered crypto/rand reads and methods for generating various random number types (Uint64, Float64, Uint32N, etc.)
cprng_test.go Comprehensive test suite including uniformity tests using chi-squared statistics, bounds checking, and performance comparison tests
rtcompare.go Updates bootstrapSample to use CPRNG when prngSeed=0; adds F2T helper function; improves documentation for RTcomparisonResult and bootstrap functions
rtcompare_test.go Adds test for high relative gains (>100% speedup) using deterministic identical samples
dprng.go Fixes spelling errors in comments ("randum" → "random") and clarifies thread-safety documentation
README.md Documents the new CPRNG feature and explains when to use DPRNG vs CPRNG
.gitignore Adds .DS_Store to ignore macOS system files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

TomTonic and others added 2 commits December 21, 2025 13:22
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tom Tonic <tom@tomtonic.de>
Copy link
Contributor

Copilot AI commented Dec 21, 2025

@TomTonic I've opened a new pull request, #29, to work on those changes. Once the pull request is ready, I'll request review from you.

TomTonic and others added 7 commits December 21, 2025 13:23
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tom Tonic <tom@tomtonic.de>
Critical bug: When prngSeed is non-zero, every call to bootstrapSample in the loop will create a new DPRNG with the same seed, causing all bootstrap resamples to be identical. This defeats the purpose of bootstrap resampling.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tom Tonic <tom@tomtonic.de>
Co-authored-by: TomTonic <20836927+TomTonic@users.noreply.github.com>
Co-authored-by: TomTonic <20836927+TomTonic@users.noreply.github.com>
Add test coverage for F2T function
@TomTonic TomTonic merged commit bfca81b into main Dec 22, 2025
5 checks passed
@TomTonic TomTonic deleted the new_cprng branch December 22, 2025 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants