We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Remove
If for some reason you want to keep RandomDotOrg.pm you should fix
hsxkpasswd/lib/Crypt/HSXKPasswd/RNG/RandomDotOrg.pm
Lines 197 to 198 in f2fcccc
my $dec = $line/($RDO_MAX_INT+1); unless($dec >= 0 && $dec <1){
Also consider fixing the slight bias in doing itemIndex = floor(rand * numberOfItems). You can do something like https://github.com/Sc00bz/ModRandom/blob/4fc203bc18bd32254c33369205557f720145abb6/random.c#L137
itemIndex = floor(rand * numberOfItems)
Edit: Changed link
The text was updated successfully, but these errors were encountered:
I just assumed that you did itemIndex = floor(rand * numberOfItems). It's actually much worse
hsxkpasswd/lib/Crypt/HSXKPasswd.pm
Line 1907 in f2fcccc
You should replace RNG.pm's random floats [0, 1) with random 32 bit integers [0, 4294967295]. Then replace _random_int with:
RNG.pm
_random_int
sub _random_int{ my @args = @_; my $self = shift @args; _force_instance($self); # validate args state $args_check = compile(NonZeroPositiveInteger); my $count = $args_check->(@args); # calculate the random number my $ans = $self->_rand(); # If nice base 2 modulo (ie 2**n) if ((($count - 1) & $count) == 0){ $ans = $ans & ($count - 1); }else{ my $skip = 4_294_967_295 - 4_294_967_295 % $count; while ($ans >= $skip){ $ans = $self->_rand(); } $ans = $ans % $count; } # return it _debug("returning $ans (max=$max)"); return $ans; }
Sorry, something went wrong.
No branches or pull requests
Remove
If for some reason you want to keep RandomDotOrg.pm you should fix
hsxkpasswd/lib/Crypt/HSXKPasswd/RNG/RandomDotOrg.pm
Lines 197 to 198 in f2fcccc
Also consider fixing the slight bias in doing
itemIndex = floor(rand * numberOfItems)
. You can do something like https://github.com/Sc00bz/ModRandom/blob/4fc203bc18bd32254c33369205557f720145abb6/random.c#L137Edit: Changed link
The text was updated successfully, but these errors were encountered: