Skip to content

Commit

Permalink
refactor: Use Helper::setElement()
Browse files Browse the repository at this point in the history
Use helper function instead of rewriting code
  • Loading branch information
braw-lee committed Nov 21, 2023
1 parent c6a368f commit 71d85f9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/modules/string/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ std::string String::binary(GuaranteeMap&& guarantee, unsigned int length)
while (true)
{
// pick random char from targetCharacters
std::mt19937 gen(std::random_device{}());
std::sample(targetCharacters.begin(), targetCharacters.end(), &generatedChar, 1, gen);
generatedChar = Helper::setElement(targetCharacters);

auto it = guarantee.find(generatedChar);
// if no constraint on generated char, break out of loop
Expand Down

0 comments on commit 71d85f9

Please sign in to comment.