Skip to content

Commit

Permalink
Fixed random record not actually being random
Browse files Browse the repository at this point in the history
  • Loading branch information
BlenderItUp committed Jun 24, 2024
1 parent 28883e2 commit 7c9076d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ global inherited sharing class ReturnNRandomRecords {
} else {
// Generate a list of random numbers
while (randomNumbers.size() < recordCount) {
Integer randomNumber = (Integer)Math.round(Math.random() * (inputCollection.size()-1));
Integer randomNumber = (Integer)Math.floor(Math.random() * (inputCollection.size()));
if( !randomNumbers.contains(randomNumber) ) {
randomNumbers.add(randomNumber);
}
Expand Down

0 comments on commit 7c9076d

Please sign in to comment.