Based on mathematical knowledge:
Sine (x) is periodic, so it will reach the same number from different x values, so Sine (x) will be terrible as a hash function, because you get multiple hash values at the same point. There are ** infinitely many values between 0 and pi for the return value, but then it passed that the values would be repeated. Thus, 0 and pi and 2 * pi will all hash to the same point.
If you can make the increment small enough and have Sine (x) multiplied by say x ^ 2 or something like that, it would be mediocre at best, but then again, if you did, why not just do not use x ^ 2 in any case and throw out the periodic function all together.
** infinite: a sufficiently large number that I do not want to count.
NOTE. The sine (x) will have values that are small and can be affected by the rounding error.
NOTE. Any value taken from the sine function must be multiplied by an integer, and then either changed, or the floor or ceiling, so that the value can be used as an offset of the array, etc.
Jeff langemeier
source share