VoxelServer/ServerCore/Tools.py

12 lines
318 B
Python
Raw Permalink Normal View History

2018-10-20 09:59:53 +02:00
#!/usr/bin/env python3
2018-11-24 18:04:53 +01:00
# taken from:
# https://stackoverflow.com/questions/47678568/deterministic-pseudorandom-number-generation/47681859#47681859
def hash2d(i, j):
x = i + (j << 32)
2018-10-20 09:59:53 +02:00
x = (x ^ (x >> 30)) * (0xbf58476d1ce4e5b9)
x = (x ^ (x >> 27)) * (0x94d049bb133111eb)
x = x ^ (x >> 31)
return x