VoxelServer/ServerCore/Tools.py

12 lines
318 B
Python

#!/usr/bin/env python3
# taken from:
# https://stackoverflow.com/questions/47678568/deterministic-pseudorandom-number-generation/47681859#47681859
def hash2d(i, j):
x = i + (j << 32)
x = (x ^ (x >> 30)) * (0xbf58476d1ce4e5b9)
x = (x ^ (x >> 27)) * (0x94d049bb133111eb)
x = x ^ (x >> 31)
return x