This uses sine as a hash function, with a random number to scale it and make it random. Sine is limited between -1 and +1, but that isn't most important for a hash. Sine is not a very good hash. Collisions are more likely. You should only really use it for learning and demo purposes.
A hash is basically a function that takes any input, and maps it to a random, but predictable output. A cryptographic* hash is one approach to securing passwords, because it is designed to be slow to generate, and hard to reverse, and minimise collisions. When a cryptographic hash is used, a random number (salt) is added to the password to change the hash even more, so the hash isn't based only on the password.