unique - PHP's uniqid function with more entropy -
question:
when using php's uniqid function more entropy set 15th character period (dot) on runs. 15th character guaranteed dot?
follow-up:
thanks @fuzzytree answer.
i investigated bit further, interested php_combined_lcg() function generates random number between 0 , 1 (such 0.862215793). reason there number before decimal because multiplied 10 (which becomes 8.62215793 in example). prevents there being 0 14th character.
yes 15th character guaranteed dot if more_entropy
set true.
from php source uniqid
if (more_entropy) { uniqid = strpprintf(0, "%s%08x%05x%.8f", prefix, sec, usec, php_combined_lcg() * 10); ^ hard coded dot here preceeded 14 characters } else { uniqid = strpprintf(0, "%s%08x%05x", prefix, sec, usec); }
Comments
Post a Comment