Reputation: 1371
I'm trying to create array of 100.000 unique 8 character strings. for input I have array of integers from 1 to 100.000. I'm planing to use crc32. Can I assume there wont be any collisions? P.S. I'm worrying only about collisions..
Upvotes: 1
Views: 931
Reputation: 154543
$result = array();
for ($i = 1; $i <= 100000; ++$i) $result[sprintf('_%u', crc32($i))] = true;
if (count($result) == 100000)
{
echo 'Yes, you can use CRC32.';
}
else
{
echo 'Ooops, you better use another algorithm.';
}
Upvotes: 2