Skip to content

fix: Remove hotfix from random numbers #977

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,9 @@ struct random_numbers {

/// Explicit normal distribution around a @param mean and @param stddev
DETRAY_HOST auto normal(const scalar_t mean, const scalar_t stddev) {
const bool is_zero_stddev{stddev == scalar_t{0}};
const scalar_t ret{is_zero_stddev ? mean
: std::normal_distribution<scalar_t>(
mean, stddev)(m_engine)};
// Hotfix for the traccc wire chamber Kalman fitter CI tests: Only a
// specific set of tracks pass the test, so detray needs to make sure
// that these tracks are generated in the random_track_generator. This
// means that the correct number of draws from the random number engine
// needs to be done in order to arrive at the SAME internal state of
// 'm_engine'. TODO: Remove once the test are stable
if (is_zero_stddev) {
std::normal_distribution<scalar_t>(mean, 1.f)(m_engine);
}
return ret;
return (stddev == scalar_t{0})
? mean
: std::normal_distribution<scalar_t>(mean, stddev)(m_engine);
}

/// 50:50 coin toss
Expand Down
Loading