Replace random rotation caching with hash function to stop major memory leak.