From b90be6b8eb8af6c824563e3e6a0266f48c86b7bd Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Fri, 22 Nov 2024 16:48:39 -0800 Subject: [PATCH] ensure seed does not overflow --- lib/WeBWorK/AchievementItems/ExtendDueDate.pm | 2 +- lib/WeBWorK/AchievementItems/ReducedCred.pm | 2 +- lib/WeBWorK/AchievementItems/SuperExtendDueDate.pm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/WeBWorK/AchievementItems/ExtendDueDate.pm b/lib/WeBWorK/AchievementItems/ExtendDueDate.pm index 096bb2c301..29c6b19d47 100644 --- a/lib/WeBWorK/AchievementItems/ExtendDueDate.pm +++ b/lib/WeBWorK/AchievementItems/ExtendDueDate.pm @@ -79,7 +79,7 @@ sub use_item ($self, $userName, $c) { my @probIDs = $db->listUserProblems($userName, $setID); for my $probID (@probIDs) { my $problem = $db->getUserProblem($userName, $setID, $probID); - $problem->problem_seed($problem->problem_seed + 100); + $problem->problem_seed($problem->problem_seed % 2**31 + 1); $db->putUserProblem($problem); } } diff --git a/lib/WeBWorK/AchievementItems/ReducedCred.pm b/lib/WeBWorK/AchievementItems/ReducedCred.pm index 85c1e5468a..da9bc0a110 100644 --- a/lib/WeBWorK/AchievementItems/ReducedCred.pm +++ b/lib/WeBWorK/AchievementItems/ReducedCred.pm @@ -87,7 +87,7 @@ sub use_item ($self, $userName, $c) { my @probIDs = $db->listUserProblems($userName, $setID); for my $probID (@probIDs) { my $problem = $db->getUserProblem($userName, $setID, $probID); - $problem->problem_seed($problem->problem_seed + 100); + $problem->problem_seed($problem->problem_seed % 2**31 + 1); $db->putUserProblem($problem); } } diff --git a/lib/WeBWorK/AchievementItems/SuperExtendDueDate.pm b/lib/WeBWorK/AchievementItems/SuperExtendDueDate.pm index 92a9dc3b57..a80145c390 100644 --- a/lib/WeBWorK/AchievementItems/SuperExtendDueDate.pm +++ b/lib/WeBWorK/AchievementItems/SuperExtendDueDate.pm @@ -79,7 +79,7 @@ sub use_item ($self, $userName, $c) { my @probIDs = $db->listUserProblems($userName, $setID); for my $probID (@probIDs) { my $problem = $db->getUserProblem($userName, $setID, $probID); - $problem->problem_seed($problem->problem_seed + 100); + $problem->problem_seed($problem->problem_seed % 2**31 + 1); $db->putUserProblem($problem); } }